I have an app with 2 tabs, the first is a listview, and the second I'm trying to make a TextView. The problem is I have no idea on how to get the TextView to show up. The listview is working, but I can't get anything on the TextView at all. I tried using the Hello, World to try to work with the text into the tab, but I can't figure it out.
My main.xml section with the TabWidget looks like this:
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/itemlist" />
<TextView
android:id="@+id/HelloAndroid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
ListView is being used on the java file with the mTabHost code,
TabHost mTabHost = getTabHost();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Answer").setContent(R.id.itemlist));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Ask").setContent(R.id.HelloAndroid));
mTabHost.setCurrentTab(0);
}
The TextView is on a different file called HelloAndroid.java, and the code looks like:
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
How can I fix it so that the 2nd tab brings up the example text? Thanks!