i have a tabbar in my android application , in each tab there is a flow of 5 to 7 activities further, all these activities must show the tab bar, so i intent in each activity using activitygroup and getLocalActivityManager like this
Intent intent = new Intent(thisActivity, activity2.class);
mView = getLocalActivityManager().startActivity("id", intent
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
)
.getDecorView();
setContentView(mView);
and i set the backbutton of this activity1 as
mView.dispatchKeyEvent(event);
so the control of back button goes to that intented activity2
then in that intented activity2 back button i override to intent to the last activity , as @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { //Back key pressed Log.d(this.getClass().getName(), "back button pressed");
Intent intent = new Intent(getApplicationContext(),activity1.class);
mView = NearByActivity.mLocalActivityManager.startActivity("activity1", intent
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
)
.getDecorView();
setContentView(mView);
return true;
}
return super.onKeyDown(keyCode, event);
}
it works fine for 2 activities but not for 5 to 6 activities in the tab when i click on back button on 3rd activity it does not override back button , it uses the activity2 back button and goes to activity 1 instead of 2
how this can be solved doing 6 7 intents in one tab content