you have to drop using Activity for ActionBar Tab and use Fragment.
Here mine Tabbed Activity that will help you
https://github.com/iNoles/Android/blob/master/AndroidNolesCore/src/activities/AbstractTabbedActivity.javaOn Sunday, March 11, 2012 7:29:16 AM UTC-4, Jose Miguel Linares Sillero wrote:
Hi all, i'm starting to develop on android and found this library by chance, i have to say that i loved from the beginning and it seems incredible. Now i only need to start working with it little by little hehe. (totally noob xD)
I am having problems implementing and adapting the sample of TabNavigation. What i'm trying to do is a TabNavigation, showing different Activitys with its contents. Without SherlockActionBar library, i have it so:
(like tutorial tab of developer.android)
intent = new Intent().setClass(this, Activity1.class);
spec = tabHost.newTabSpec("Activity 1").setIndicator("Activity 1",
res.getDrawable(R.drawable.ic_tab_info))
.setContent(intent);
tabHost.addTab(spec);
Now, looking at the source from the sample of TabNavigation of SherlockActionBar:
I put the Tabs:
ActionBar.Tab tab1 = getSupportActionBar().newTab();
tab1.setText("Activity 1");
tab1.setTabListener(this);
getSupportActionBar().addTab(tab1);
and in function onTabSelected, as an issue here, i put:
int iPosition = tab.getPosition();
String tabText = tab.getText().toString();
switch(iPosition)
{
case 0:
Intent intent = new Intent(this, Activity1.class);
startActivity(intent);
break;
(...)
If I do this, the Activity is fully open and i lose the Tab menu. :(
I think my problem is just being a nooooooob, i think the problem is how to declare the Activitys. With the first method are Activitys normal, but with SherlockActionBar i think i need to declare them in a particular way... but honestly i can not think how to put it :(