Single Instance of Activity

后端 未结 2 1258
既然无缘
既然无缘 2020-12-11 05:19

My application has three activities say A -> B-> C.

Activity A is called from another activity through startActivityForResult(). Acti

2条回答
  •  一向
    一向 (楼主)
    2020-12-11 05:48

    Using android:launchMode="singleTask" is probably the best approach, since it won't recreate the activity if it's already running. Just add it to the activity in your AndroidManifest.xml, and you should be all set.

    
        
            
            
        
     
    

    Here's another question that might be useful: Android singleTask or singleInstance launch mode?

提交回复
热议问题