Which method is run when Home button pressed?
tapping the Home button creates an intent to launch the Home screen and then starts that intent
Correct.
If this is the case, I'd expect the onCreate() method to be run whenever the Home screen is created
Not necessarily. If it is already running, it would be called with onNewIntent()
.
If someone could just offer some enlightenment into this matter, the basic question is whether onResume() or onCreate() gets called when I tap the Home button
Any time any activity returns to the foreground from a user input standpoint, onResume()
is called. Home screens should be no different in this regard.
onCreate()
is called when the activity is created. Existing activities are not created, but are merely brought back to the foreground. If what triggered the activity to return to the foreground was a startActivity()
call, the activity will be called with onNewIntent()
and onResume()
(and usually onStart()
, for that matter).
what method is called when Actionbar back/home button is pressed?
you can remove the fragment in e.g. onDestroy()
of the activity, so the fragment will go through it's lifecycle methods
Which methods are called only if I press the Home Button?
When you press the Home button on the device, the onPause method will be called. If the device thinks that it needs more memory it might call onStop to let your application shut down. The device can restart your application later from a stopped state. If your process killed, onDestroy will be called.
http://www.androidside.com/data/geditor/0812/1062731775_4e7c4d93_android+activity+life+cycle.jpg
Related Topics
Org.JSON.JSON Exception:End of Input at Character 0
Marking Sms Messages as Read/Unread or Deleting Messages Not Working in Kitkat
Unresolved Reference - Activity Does Not Recognize Synthetic Imports in Android Studio V4
Getting Latitude and Longitude in 30 Seconds
Generate APK File from Aab File (Android App Bundle)
How to Make an Android App to Always Run in Background
Android Image View Pinch Zooming
Android Webview with an Embedded Youtube Video, Full Screen Button Freezes Video
Background-Size: Cover Not Working in Portrait on Android Tablet
What Is the Default Unit of Style in React Native
How to Simulate :Active CSS Pseudo Class in Android on Non-Link Elements
What Does -Webkit-Text-Size-Adjust Do
Overflow Auto Doesn't Work in Android Browser
What's Dp (Density Independent Pixels) Units with CSS
Actionbar Up Navigation with Fragments