Hi, I am working on this issue for 2 days now, and i cant find any answer to my problem, hope anyone can help me.
this is my main.java:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TabHost tabs = (TabHost)this.findViewById(R.id.th_set_menu_tabhost);
tabs.setup();
TabHost.TabSpec ts1 = tabs.newTabSpec("Page 1");
ts1.setIndicator("", this.getResources().getDrawable(R.drawable.icon1));
ts1.setContent(R.id.content1);
tabs.addTab(ts1);
TabHost.TabSpec ts2 = tabs.newTabSpec("Page 2");
ts2.setIndicator("",this.getResources().getDrawable(R.drawable.icon2));
ts2.setContent(R.id.content2);
tabs.addTab(ts2);
TabHost.TabSpec ts3 = tabs.newTabSpec("Page 3");
ts3.setIndicator("",this.getResources().getDrawable(R.drawable.icon3));
ts3.setContent(new Intent(this, People.class));
//ts3.setContent(R.id.content3);
tabs.addTab(ts3);
}
}
and this is my main.xml:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/th_set_menu_tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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="200dp"
android:paddingTop="30dp">
<LinearLayout
android:id="@+id/content1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/content2"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/content3"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
</TabHost>
and i was trying to add a different view/layout than the default one in main.xml to one of the tabs (tab3).
the class people.java is a simple file:
public class People extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tabcontent1);
}
}
which calls the tabcontent1.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content4"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="plain.xml" />
</LinearLayout>
but it got me error on emulator when i am clicking on "tab3" which intents the people.class.
anyone can help me would be really appreciated.
Tinne
[fade]


