I have more than one activities .if i click an exit button ,I have to exit from my application.
I have searched the google i got two options.Which is right method ?
First method:
Intent intent = new Intent(ExitConfirmationActivity.this, FirstActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); And override the onResume of initial activity with a finish();
Second method:
closing all activities one by one .
I have searched the google i got two options.Which is right method ?
First method:
Intent intent = new Intent(ExitConfirmationActivity.this, FirstActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); And override the onResume of initial activity with a finish();
Second method:
closing all activities one by one .