Maintaining standard application Activity back stack state in Android (using singleTask launch mode)

后端 未结 3 1672
心在旅途
心在旅途 2021-01-06 06:47

I am having trouble finding out how to maintain the state of my Android app in development.

Just to clarify, I am not talking about maintaining activity state (i.e.

3条回答
  •  悲哀的现实
    2021-01-06 07:19

    As I understand the question you want to launch your application and have a different thing happen each time depending on where you left off the last time. http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html The activity lifecycle is in the link. Your onActivityDestroyed method somehow needs to persist the present state and the oncreate needs to pick it back up. Persistence can be achieved via shared preferences, stored in a file, database or over the network http://developer.android.com/guide/topics/data/data-storage.html This unpredictable behavior could cause confusion for the end user if poorly implemented so use good judgement.

提交回复
热议问题