Switching Between Tab Using Activity Group It Want To Display Last Activity - Tab Activitygroup
Solution 1:
I think you have to override onBackPressed() inside activities which you are opening in activity-group
Write a code below in each activity which you are opening in activity-group
@Override
publicvoidonBackPressed() {
SalesActivityGroup.group.back();
}
And also replace the onBackPressed() with following code in TABHOST
@OverridepublicvoidonBackPressed() {
super.onBackPressed();
}
Best of luck
Solution 2:
The activity groups you created will hold your current activity view will not change unless you change it, Therefore while you are navigating between tabs the activity groups you have assigned to those tabs will not change their views will remain as it is.
You can try this ....
For each of your activity you must override onBackPressed() ...
@Override
publicvoidonBackPressed() {
ActivityGroupRelatedToThisActivity.group.back();
}
Also remember do not callsuper.onBackPressed() in any of your Activity which is related to activity group
Or
Change private ArrayList<View> history to static private ArrayList<View> history
and
if(history.size() ==0) replaceView(view);
in ActivityGroup's onCreate() method
Solution 3:
I think you are having a problem in back() of ActivityGroup, please try this.
publicvoidback()
{
if ( history.size() > 1 )
{
history.remove(history.size() - 1);
View v = arrList.get(history.size() - 1);
setContentView(v);
}
else {
this.finish();
}
}
Solution 4:
This answer will be help you. I have used the group activity for my tabs. Let me know if you still find the problem
Solution 5:
Thanks All;
There were issue in my MainActivity.
tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = newIntent().setClass(this, SalesActivityGroup.class);
spec = getTabHost().newTabSpec("Sales").setIndicator("Sales",getResources().getDrawable(R.drawable.ic_tab_artists_grey)).setContent(intent);
tabHost.addTab(spec);
intent = newIntent().setClass(this, SettingActivityGroup.class);
spec = getTabHost().newTabSpec("Admin").setIndicator("Admin",getResources().getDrawable(R.drawable.admin)).setContent(intent);
tabHost.addTab(spec);
intent = newIntent().setClass(this, SettingActivityGroup.class);
spec = getTabHost().newTabSpec("Setting").setIndicator("Setting",getResources().getDrawable(R.drawable.ic_tab_artists_grey)).setContent(intent);
tabHost.addTab(spec);
intent = newIntent().setClass(this, SettingActivityGroup.class);
spec = getTabHost().newTabSpec("Inquiry").setIndicator("Inquiry",getResources().getDrawable(R.drawable.ic_tab_artists_grey)).setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
tabHost.setMinimumHeight(18);
tabHost.setFadingEdgeLength(5);
tabHost.setFocusable(true);
tabHost.requestFocus();
tabHost.setFadingEdgeLength(5);
}
}
And I agree @Vaibhav Jani @Dharmendra @Suri, I missed that onKeyPressed() in all Activity.
Post a Comment for "Switching Between Tab Using Activity Group It Want To Display Last Activity - Tab Activitygroup"