April 2019
Beginner to intermediate
698 pages
15h 15m
English
Let's get started with coding the Activity-based class. As usual, the class is called MainActivity, and it was autogenerated for us when we created the project.
Edit the class declaration and add the first part of the code for the MainActivity class:
import android.app.Activity
import android.os.Bundle
import android.graphics.Point
class MainActivity : Activity() {
private lateinit var liveDrawingView: LiveDrawingView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val display = windowManager.defaultDisplay
val size = Point()
display.getSize(size)
liveDrawingView = LiveDrawingView(this, size.x)
setContentView(liveDrawingView)
}
}The preceding code shows several errors that we ...
Read now
Unlock full access