Back key
Android programs do not have to deliberately quit, when you press the back of the phone, the system will default to call the top activity in the program stack Destroy () method to destroy the current activity. When this activity is started again by other activity, the OnCreate () method is called again to create, and when all activity in the stack pops up, the application ends. If there is a service in the program, It is possible to listen to the processing in the right place.
Home Key
Android program is hidden, when you press the phone's home button, the system will default to call the top activity in the program stack Stop () method, and then the entire application will be hidden, when you click on the Phone Desktop app icon again, The system invokes the Onresume () method of the topmost activity, which does not reopen the program, but directly enters, showing the topmost activity in the stack.
The back key defaults to the current activity to the Finish,home key only to the activity to OnStop.
Back Key Imitation home key function:
@Override Public void onbackpressed () { // Implement home key effect // new Intent (intent.action_main); I.setflags (intent.flag_activity_new_task); I.addcategory (intent.category_home); StartActivity (i); }
The difference between Android back key and home key