I ve searched and I know it seems some people frown upon using activities within tabs, but moving past that...how would I restart a tabbed activity while still keeping the tabs visible? I have an activity in a tab, I use the menu to create a new activity to update the tab s activity displayed info, when I return from the menu activity I want the new information to be displayed in the tab s activity. I am using startActivityForResult() from the menu choice, but when I return and try to restart the activity...it wipes out the tabs above(I guess as expected, but I want to re-launch the refreshed activity within the tab).
Creating the tabs:
TabHost host = getTabHost();
Intent home_intent = new Intent(constants.HOME_ACTION,
null, this, homeTab.class);
Intent inbox_intent = new Intent(constants.INBOX_ACTION,
null, this, inboxTab.class);
Intent stats_intent = new Intent(constants.STATS_ACTION, null,
this, infoTab.class);
host.addTab(host.newTabSpec(constants.HOME_TAG)
.setIndicator(getText(R.string.home_label),
getResources().getDrawable(R.drawable.icon))
.setContent(home_intent));
host.addTab(host.newTabSpec(constants.INBOX_TAG)
.setIndicator(getText(R.string.inbox_label),
getResources().getDrawable(R.drawable.icon))
.setContent(inbox_intent));
host.addTab(host.newTabSpec(constants.STATS_TAG)
.setIndicator(getText(R.string.stats_label),
getResources().getDrawable(R.drawable.icon)).setContent(
stats_intent));
Return from the menu activity in the tab s activity(updating database info):
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case (constants.ACTIVITY_REQUEST_CODE_UPDATE_PROFILE) : {
if (resultCode == Activity.RESULT_OK) {
boolean profileUpdated = data.getBooleanExtra(constants.ACTIVITY_BUNDLE_UPDATE_PROFILE, false);
Log.d(LOG_TAG, "activity returned with " + profileUpdated);
// Check to see if we updated our profile to refresh the screen
if(profileUpdated == true){
// Refresh the screen with the new info
homeTab.this.finish();
this.startActivity(getIntent());
}
}
break;
}
}
}