I have a tabActivity class.
class MainActivity extends TabActivity {
TabHost tabHost = getTabHost();
TabSpec tabOne= tabHost.newTabSpec("Tab One");
tabOne.setIndicator("Tab One", getResources().getDrawable(R.drawable.tab1));
Intent tabOneIntent = new Intent(this, PhotosActivity.class);
tabOne.setContent(tabOneIntent);
TabSpec tabTwo= tabHost.newTabSpec("Tab Two");
tabTwo.setIndicator("Tab Two", getResources().getDrawable(R.drawable.tab2));
Intent tabTwoIntent = new Intent(this, TabTwo.class);
tabTwo.setContent(videosIntent);
tabHost.addTab(tabOne);
tabHost.addTab(tabTwo);
}
And one of the tabs is
class TabTwo extends Acitity implements OnClickListener{
public void onClick(View view) {
//open a new activity within the tab
}
}
And the dummy activity is
class DummyActivity extends Activity {
}
When I click tab two, TabTwo class is invoked. When I click a button from within the class, I want to open a DummyActivity within the tab. The code being used now is
context.startActivity(intentObject);
This will open the new activity in absolutely new window. How can I open the DummyActivity from within the tab?
Thanks in advance!
@all Thanks for the responses. I solved the issue using ActivityGroup and child activties.
It does not looks like usual android app experience. Be very careful with doing such things.
Since 3.0 it’s better to use
Fragments. If you want to support earlier devices – use compatibility library.