tabHost.addTab(tabHost.newTabSpec("Tab1")
.setIndicator("Tab1")
.setContent(new Intent(this, TabActivityGroup.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
class TabActivityGroup extends ActivityGroup{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Some code
View view = getLocalActivityManager()
.startActivity("Tab1", new
Intent(this,YourActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
this.setContentView(view);
}
}
class YourActivity extends ActivityGroup {
private Button timeButton = null;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.itemseach);
initialButton();
}
private void initialButton() {
timeButton = (Button)findViewById(R.id.searchTagTime);
timeButton.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
View view = getLocalActivityManager().startActivity(
"Tab1",
new Intent(getBaseContext(), SearchByTime.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
setContentView(view);
}
});
}
}