Im in a process of learning android.
Want to implement tabbed browsing functionality; For this purpose I have following activity
public class CustomList extends ListActivity {
....
and inside this (and other activities I want to put the tabs)
for example:
Resources res = getResources();
**TabActivity ta = new TabActivity();**
TabHost host = **ta.getTabHost();** // this line returns **NullPointerException**
host.addTab(host.newTabSpec("first")
.setIndicator("First")
.setContent(new Intent(this, First.class)));
These lines are included inside OnCreate().
Probably it would be better to have separate activity with tab definitions and just call it in every other activities. But, Im not sure how to do this.
Please for suggestion to solve this issue. Thank you in advance.
I think what you want is to have multiple activity within a single tab.
In order to do this, you have to first create an Activity which extend TabActivity, and initialize its tabs with activities extending TabGroupActivity.
Here is a link with more informations on how to have multiple activities in a TabActivity