In my application I first display to the user a disclaimer page as the “home” tab. This page contains a textbox and a submit button which stores a username into the SharedPreferences. I would like to change the intent of the “home” tab to display a “thank you” page instead of the “disclaimer” page. I currently have it as follows under the onCreate() method of the TabActivity class. The problem with this is that it doesnt refresh the new intent when the user submits their username.
String pulledUsername = getSharedPreferences("com.blah.application", MODE_PRIVATE).getString("username",null);
if (pulledUsername != null){
intent = new Intent().setClass(this, HomeActivity.class);
spec = tabHost.newTabSpec("home").setIndicator("Home",
res.getDrawable(R.drawable.ic_tab_home))
.setContent(intent);
tabHost.addTab(spec);
}
else {
intent = new Intent().setClass(this, DisclaimerActivity.class);
spec = tabHost.newTabSpec("home").setIndicator("Home",
res.getDrawable(R.drawable.ic_tab_home))
.setContent(intent);
tabHost.addTab(spec);
}
I would like to either change the “home” tab’s intent after the user clicks submit or possible have the TabWidget actively checking to see if the pulledUsername is stored in the phone instead of just onCreate().
Solved by using