Activity lifecycle if application reopened Android emulator example

First step was hidden application after HOME button was pressed.
Second step is restart application if user clicked on application’s icon.

20:35:54.028: VERBOSE/BackupManagerService(60): Backup requested but nothing pending
 
//   reopen - rerstart application if long time is emulator disuse (about 10 minutes) is
// called onRestoreInstanceState()
20:45:59.117: INFO/ActivityManager(60): 
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
flg=0x10200000 cmp=cz.okhelp/.AndroidLifeCycle } from pid 135
 
 
20:45:59.277: INFO/onDestroy(339): onDestroy()
20:45:59.588: INFO/onCreate(339): onCreate()
20:45:59.628: INFO/onStart(339): onStart()
20:45:59.668: INFO/onRestoreInstanceState(339): onRestoreInstanceState()
20:45:59.719: INFO/onResume(339): onResume()

If application restarted immediately as HOME button pressed onRestoreInstanceState() not called.

 
10-08 20:55:16.738: INFO/ActivityManager(60): 
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
flg=0x10200000 cmp=cz.okhelp/.AndroidLifeCycle } from pid 135
10-08 20:55:16.868: INFO/onRestart(339): onRestart()
10-08 20:55:16.908: INFO/onStart(339): onStart()
10-08 20:55:16.948: INFO/onResume(339): onResume()

The following diagram shows the important state paths of an Activity if application is reopened, not a new start.
life_cycle_if_app_restarted

This entry was posted in Android Examples Code and tagged , , . Bookmark the permalink.


Comments are closed.



6,547 views