I\'ve got 4 activities say Act1
, Act2
, Act3
and Act4
.
A button in Act1 opens Act2, a button in Act2 opens Act3, a button in A
I use this method :
1. Create static activity in the first activity that will close the
remaining activity(s).
2. Then call it in the static method like this, it will close the app from wherever you call it.
public static Activity activity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activity=this;
}
public static void CloseApp(){
activity.finish();
}