I have a list View and now I am trying to set up tab view for this list view.
Now sometime there are 3 options, sometimes 2 and sometimes 1. As you can see here
And when a tab is clicked I will reload my list view with new data depending on which item in the tab bar was clicked. But this is similar data, so it will be in the same list view and I want to use the same xml layout. But currently I am unable to do this, I can't see to get it working it.
Here is what I have so
myTabHost =(TabHost) findViewById(R.id.TabHost01);
myTabHost.setup();
TabHost.TabSpec spec1 = myTabHost.newTabSpec("First Tab");
spec1.setIndicator("First Tab", getResources().getDrawable(android.R.drawable.ic_menu_add));
spec1.setContent(R.id.tab1);
myTabHost.addTab(spec1);
myTabHost.addTab(myTabHost.newTabSpec("Second Tab").
setIndicator("Second Tab", getResources().getDrawable(android.R.drawable.ic_menu_edit)).setContent(R.id.tab2));
This is setting it up for 2 tab, and then in the xml I have
<include
android:id="@+id/tab1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
layout="@layout/item_list_view">
</include>
<include
android:id="@+id/tab2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
layout="@layout/test">
</include>
But I want to use the same layout instead of different ones and just reload the data but when I set the tabs .setContent to the same id it doesn't work?
So the basic question is how do I use the same xml for more than one tab, and just load different data in the list view?
The tab bar will be filled with text not images if that matters. Have looked at some tutorals on this but aren't helpful for my situation https://www.youtube.com/watch?v=OeNC_sShJXs https://www.youtube.com/watch?v=1-u3toC6ctY
So I need some help setting this up.
Thanks for the help in advance :)