Reputation: 5966
So I have a TabActivity that branches into three sub-activities (tabs). One of these activities is a ListView, which I want to branch into further ListView activities. However, I want each of these branched ListViews to also have the same tabs at the top. To do this, do I need to create a separate TabActivity and a separate Activity for each of these branched ListViews? Or is there an easier way?
Upvotes: 1
Views: 51
Reputation: 3489
Cannot you trick a user into having TabActivities, but instead simply have one ListView
instance with 3 buttons on the top of an activity (Tabs) and every time user clicks one of the "fake" tabs, just refresh the existing ListView
with views that are appropriate for one of those "fake" tabs. In my opinion this solution would be more efficient resource-wise and render time -wise (which anyway are dual concepts)
This is what I have in mind
You may use Fragments
as proposed by MaciejGórski for TabActivityOne
, TabActivityTwo
and TabActivityThree
, while the ListView inflation technique could still be used
Upvotes: 1
Reputation: 22232
Switch from the old deprecated APIs using like TabActivity
or ActivityGroup
into Fragment
s.
This class was deprecated in API level 13.
New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to DONUT.
From TabActivity documentation.
Upvotes: 0