

You Log a message when the Activity is created. This makes it easier to see which class the message is coming from.

The convention on Android is to use the class name in log messages. You assign the name of your class to TAG. Then, add the following line below the call to setContentView in onCreate(): Log.d(TAG, "onCreate called.

In MainActivity.kt, add the following property to the top of the existing properties: private val TAG = MainActivity:: You can even log and check the values of your variables at runtime. With logging, you can find out what’s happening at certain points within your code. The first debugging approach is to add logging to your app. Whoops! To understand why this happens, you need to begin analyzing the code. Notice anything strange? TimeFighter resets the game when you rotate the device. Rotate the device, notice something different? To do this, swipe the notification drawer down to reveal the quick settings and ensure the auto-rotate button is colored green to signify it’s enabled. You may need to enable auto-rotate on your device or emulator if the screen doesn’t rotate automatically. Note: For devices running Android Pie and above. Push TAP ME a few times, and then change the orientation of the device to landscape. Start the app in the emulator or on your device. You might not have noticed, but TimeFighter has a bug. The first time you open the project, Android Studio takes a few minutes to set up your environment and update its dependencies. Locate the projects folder for this chapter and open the TimeFighter app inside the starter folder. If you’ve been following along, open your project in Android Studio and keep using it for this chapter.

11.4 Adding the ListSelectionFragment to MainActivity.10.5 Passing the Task to the RecyclerView.8.6 Showing Real Lists in the RecyclerView.7.4 Hooking up a RecyclerView using ViewBinding.Section II: Building a List App Section 2: 7 chapters 2.2 These are not the SDKs you’re looking for.1.7 Installing new versions of Android Studio.Section I: Your First Android App Section 1: 5 chapters
