Pergunta

I am facing some problems so as a conclusion can I get how to know current Activity is finished or not in onSavedInstanceState() ? Is there any possible solutions then let me know.

Foi útil?

Solução

In your Activity, you can call isFinishing() (which can tell you if the Activity is in the process of finishing) or isDestroyed() (which can tell you if the Activity is invalid). Please note that isDestroyed can only be called if you are using API 17 or above.

For the official references, you can see here: http://developer.android.com/reference/android/app/Activity.html#isDestroyed() http://developer.android.com/reference/android/app/Activity.html#isFinishing()

Outras dicas

Check for onDestroy() Method, if its gets called or not.

According to android docs

The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.

If your onDestroy method of activity gets called your activity will be finished and no instance will be saved in the back stack.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top