Search code examples
androidkindle-fire

application starts from beginning after kindle autolocks


I have an application that i have to run in kindle fire.

The application is running fine,but after kindle autolocks,application starts from beginning and not from where the application was before the autolock.

why does this happen?


Solution

  • Make sure you are saving your application's state.

    Activities in Android have a very special lifecycle. Whenever an app is put in the background, it calles onPause() and when you bring it back into view, onResume() is called.

    So you'll want to save the state whenever onPause() or onStop() is called and load the state on onCreate() and onResume()

    For more about states, read here

    Edit: Also have a look at onSaveInstanceState()