Android: open activity without save into the stack

前端 未结 10 1912
暗喜
暗喜 2020-11-27 04:19

I have 2 activities: Main and List.

From Main you can open List; from List you can open Main.

I\'d like it so that every opening of List does not

10条回答
  •  隐瞒了意图╮
    2020-11-27 05:22

    Can you not override the back button on the particular activity to stop the 'return' functionality?

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
    
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
    

提交回复
热议问题