Hi, With Koala the Empty Activity defaults jetpack compose. I am making the presumption that the most similar “new project” to the xml version of Empty Activity is Empty Views Activity.
However the default MainActivity.kt is:
You are correct, we should use “Empty Views Activity” everytime we start a new project while following along with the book. I don’t know what “enableEdgeToEdge()” and it’s corresponding import statement does. I tried deleting them, didn’t notice any difference, ultimately I left them in. I left all the starter code in MainActivity.kt alone. I believe your replacement code will work for a while, however, notice at the beginning of each chapter in the book there will be a picture of how your project will look by the end of the chapter. Notice that these examples in the book have a navigation bar at the top whereas your project doesn’t. This will eventually become an issue as you make progress in the book. I would recommend leaving the default code of main activity as it is, and adding an
android:id="@+id/main"
tag to activity_main.xml to resolve the error thrown by “R.id.main” in:
Hi Phil
Thank you so much for answering this. Having the Forum linked to the book is a very good asset. Enjoying the book very much.
All the best from Barry Island in South Wales UK
Ric