I want to restart an instan开发者_如何学编程ce of my activity. Is it possible?
For example from an activity, I will go to another activity then when I go back to previous activity, all is new, no instance is saved.
I'm kinda new to android. thanks.
Maybe this old post could help you: how do i restart an android activity
I just solved this by adding this line into my android manifest:
android:launchMode="singleInstance"
This is you declaring that you don't want to instantiate a new activity every time you start an intent of one. You can now reuse existing activities. Here's a link to the API document that explains this and other activity tweaks in the manifest file:
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
This is an old question but hopefully this answer can help people still trying to figure this out.
精彩评论