Here my situation:
I have setup 5 Activities:
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AllRadiosActivity"></activity>
<activity android:name=".FavoritesListActivity"></activity>
<activity android:name=".SearchActivity"></activity>
<activity android:name=".NowPlayingActivity"></activity>
The MainActivity setups up 4 tabs (for the 4 activities):
TabHost host = getTabHost();
host.addTab(host.newTabSpec("1").setIndicator("All").setContent(new
Intent(this, AllRadiosActivity.class)));
host.addTab(host.newTabSpec("2").setIndicator("Faves").setContent
(new Intent(this, FavoritesListActivity.class)));
host.addTab(host.newTabSpec("3").setIndicator("Search").setContent
(new Intent(this, SearchActivity.class)));
host.addTab(host.newTabSpec("4").setIndicator("Now
Playing").setContent(new Intent(this, NowPlayingActivity.class)));
host.setCurrentTab(0);
Where I'm running into issues is when I switch from the
AllRadiosActivity to the NowPlayingActivity, the tabs aren't displayed
anymore (since they are only defined in the MainActivity).
Here is the command I use to switch between the activities:
mView is a ListView
mView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView av, View v, int
index, long
arg) {
Log.d(TAG, "Item clicked: " + index);
//startActivity(new
Intent("NowPlayingActivity"));
Intent myIntent = new Intent(v.getContext(),
NowPlayingActivity.class);
startActivity(myIntent);
}
});
Does anyone know how to keep the tabs while switching between the
'subactivities'?? The reason I'm using the MainActivity is because I
can extend the appropriate Activity class (ListActivity, etc) in all
of the other activities.
Any help would be appreciated!
Thanks!
Vladimir
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---