- Activity Root/onCreate() - 이전 액티비티

1
2
3
4
5
      // 종료
        if (getIntent().getBooleanExtra("EXIT_ROOT"false)) {
            this.finishAndRemoveTask();
            System.exit(0);
        }
 
cs

 

- Activity Main - 현재 액티비티

1
2
3
4
5
6
7
8
9
10
11
  @Override
    public void onBackPressed() {
        exitApp();
    }
 
    private void exitApp(){
        Intent i = new Intent(this, ActivityRoot.class);
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        i.putExtra("EXIT_ROOT",true);
        startActivity(i);
    }
cs

+ Recent posts