App always starts fresh from root activity instead of resuming background state (Known Bug)

前端 未结 5 1882
庸人自扰
庸人自扰 2020-11-28 22:00

I am facing exactly the problem mentioned in these links:

http://code.google.com/p/android/issues/detail?id=2373

http://groups.google.com/group/android-devel

5条回答
  •  迷失自我
    2020-11-28 22:21

    Just add this in onCreate method of your launcher activity like this:

          @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        if (!isTaskRoot()) {
            finish();
            return;
        }
        // other function
        }
    

提交回复
热议问题