Demonstrate your app iterating through the Activity Lifecycle.
The real point of the lab: Familiarize yourself with when each of the events is triggered!!!
Assignment: Show the number of times that each method of the activity lifecycle has been reached.
You are to make an app that displays how many times each of the required methods have been reached (two sets of data)
Set 1: how many times each method has been called in this particular run. Each counter will reset to zero when you restart the app
Set 2: how many times each method has been called, for as long as the app has been installed on your phone (i.e. save the numbers in SharedPreferences).
Required methods:
onCreate()
onStart()
onResume()
onPause()
onStop()
onRestart()
onDestroy()
Demonstrate the following:
Display the number of times each method was reached
Display the number of times each method was reached since app installation
Include a meaningful and functional GUI element that allows you to reset the counters
Optional:
Create and Use a Custom Class with an appropriate name to store your variables (use alt+insert to generate getters and setters) - Look up GSON and JSON
Get name of current method being executed in Java
https://www3.ntu.edu.sg/home/ehchua/programming/android/Android_BasicsMore.html#zz-1.
Demo Video
Video record your app while demonstrating each event and the current and lifetime counts of triggered events.
Build the .apk file
Rename the .apk file
PeriodLabNumberLastFirstCustomName.apk
P8L05aTraDanLifecycle.apk
Submit assignment
Video of events triggered counting
.apk file
MainActivity.java
Redo 1 or more of your previous labs or embellishments while handling lifecycle events
Submit as Lab05b
P8L05bTraDanLifecycle.apk
Submit video as appropriate