How to always start from a startup activity on Android?

后端 未结 9 1343
走了就别回头了
走了就别回头了 2020-12-09 10:52

There are three different cases:

1) A user launches an app, navigates in it, pressed home and click on the app icon again to launch our app again.

2) A user

9条回答
  •  半阙折子戏
    2020-12-09 11:50

    I know you don't want to manage it in all activities but you can do this and still handle the code in one place with a super activity

    public abstract class BlundellActivity extends Activity {
         @Override
         public void onPause(){
             // Whatever strategy you want
         }
    }
    
    public class SomeActivity extends BlundellActivity {
         // Do whatever you normally want to do
    }
    
    public class SomeActivity extends BlundellActivity {
         // Do whatever you normally want to do here as well
    }
    

提交回复
热议问题