I want to close all activities in th stack before going to new activity.
this is my code
Intent i=new Intent(first.this,secondsct.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
//i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
//i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
finish();
But this is not working. I have tried this earlier but not now. I dont know why. Can anyone know what may be the reason.