Assume i have four classes.Each class is having a button to do screen switching from one page to another page,well its working fine.But now im trying to close all the activi
Simply try this. Consider your Class3.java is your last Activitiy And, in Button of next use below code -
Intent intent = new Intent(currentActivity.this, XitActivity.class); // instead of XitActivity use your first activity
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("EXIT", true);
startActivity(intent);
And, in your Xit_demoActivity's onCreate() use below code -
if (getIntent().getBooleanExtra("EXIT", false)) {
finish();
}
Hope this will helps you to exit you from all activities.