Search code examples
androidiosandroid-lifecycleios-lifecycle

Does suspended state exist in Android?


In iOS if user press home button, app will move to suspended state. Double click of the home button, suspended apps appear, and selecting an app will bring back it to active state.

  • How is it by Android? App can become to suspended state pressing center button? Or app move to not running state?
  • If suspended state exist, how to bring back to running state, where I can select one app among many?
  • In an activity the oncreate method will get called only once, when app first starts? Which method is get called that will called always when app appears, come back to running state?

Solution

  • Have a look over Android Activity Lifecycle

    In android, if the app is not "on the main screen" it counts as Paused state.

    By starting an app, there will be a one and only call for onCreate, later will be called onStart and onResume. If you will now click the home button, the onPause and onStop method will be called. Once you wish to back to the activity you can press the Overview button, and select your app from the list and the method onRestart, onStart and onResume will then be called.

    If your app is not fully hidden, e.g you swing your finger from top to bottom to see "notification center", this will cause skipping the onStart, onStop and onRestart functions.