How activity instance creation is handled in android?
My app has the following activities. A B C D. I launch app .. so going to A --> B (startActivity - Intent for B) from B --> C (startActivity - Intent for C) from C --> D (startActivity - Intent for D)
Here in D I have 2 buttons. one takes to B and another to C If user clicks B button I do startActivity - Intent for B ======> Does this create a new instance of activity B or开发者_高级运维 reuse the already existing instance of B? If it doesnt reuse is there a way we can have it reuse the existing activity instance.
Note: I don't need to worry about the state of instance as all fields are static.
associate the
android:launchMode="singleTask"
with your activity tag activity B in your manifest file
for further reference you can refer to link http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
精彩评论