Skip going back to direct parent activity when pressed back

前端 未结 8 2032
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 22:37

I have got a small problem in an Android app I am working on :

There are 3 activities namely A , B , C and the invocation is in the following order : A -> B -> C.

8条回答
  •  醉酒成梦
    2020-12-09 22:59

    • In activity B:

      public static boolean mDestroyActivity = false; @Override protected void onResume() { super.onResume(); /** * exit when back from Activity C-> A (skip activity B) */ Log.i("FINISH", "= " + mDestroyActivity); if (mDestroyActivity) { mDestroyActivity = false; finish(); } }

    • In activity C:

      B.mDestroyActivity = true;

提交回复
热议问题