Top "Android-lifecycle" questions

Questions regarding the events forwarded by the system to components, during their lifetime, in an Android Application.

Minimal android foreground service killed on high-end phone

I'm trying to create an app that lets users log routes (locations/GPS). To ensure locations are logged even when …

android android-service android-lifecycle android-location android-doze
Android view - onAttachedToWindow and onDetachedFromWindow - when are they called in the activity lifecycle?

I believe that onAttachedToWindow() is called when the onCreate()'s setContentView(R.layout.myLayout.xml) is called. So can I …

android android-lifecycle
Access to application class in Broadcast Receiver

I want to check internet connection in Broadcast Receiver; And set result (A boolean flag) to a global variable, to …

broadcastreceiver android-lifecycle android-broadcast android
What is the difference between setContentView and LayoutInflater?

I am creating a tabs list with several fragments. I have noticed that, in the main activity, I used setContentView …

android layout xml-parsing android-lifecycle layout-inflater
When can onTaskRemoved() be called?

The docs state that This is called if the service is currently running and the user has removed a task …

android android-service android-lifecycle
NavUtils.navigateUpTo() does not start any Activity

I have two activities MainActivity DeepLinkActivity I set up everything to use the NavUtils for navigating up like advised here, …

android android-activity android-lifecycle
Differentiate between Android killing the app and user swiping it off on the recent apps list

I am working on a project, where while being on a specific Activity we show a local sticky notification. That …

android android-activity android-lifecycle
Difference between onResume() and onResumeFragments()

FragmentActivity.onResume() javadoc: Dispatch onResume() to fragments. Note that for better inter-operation with older versions of the platform, at the …

android android-fragments android-fragmentactivity android-lifecycle
DialogFragment - retaining listener after screen rotation

I have a DialogFragment which creates a DatePickerDialog. I'm using a static method called newInstance to set the initial values …

android android-fragments android-lifecycle