Following situation: I have TabActivity with e.g. three tabs, TabA, TabB, TabC.
There are a button in activity (Act_C_1) of TabC. So if the user clicks on that button, another activity (Act_C_2) should occur in TabC.
I thank you in advance for any suggestions / or ideas.
Mur
UPD:
Here is my code
TabActivity with three Activities:
public class TabScreen extends TabActivity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_menu);
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
intent = new Intent().setClass(this, SecondActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("tab_1").setIndicator("Tab1",null).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, ThirdActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("tab_2").setIndicator("Tab2",null).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, FourthActivity.class);
spec = tabHost.newTabSpec("tab_3").setIndicator("Tab3",null).setContent(intent);
tabHost.addTab(spec);
}
}
Activity 'Act_C_1' or FourthActivity.java:
public class FourthActivity extends Activity implements OnClickListener
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.fourth);
Button BtnWeiter = (Button)findViewById(R.id.BtnWeiter);
BtnWeiter.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
// I also tried to use LocalActivityManager
// TabActivity parentTabActivity = (TabActivity) getParent();
// LocalActivityManager manager = parentTabActivity.getLocalActivityManager();
// manager.destroyActivity("tab_3", true);
// manager.startActivity("tab_3", new Intent(this, FourthActivity.class));
finish();
startActivity(new Intent(this, FourthActivity.class));
}
}