The following code does not work......What is problem?
***java code:-
package com.tabj;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;
public class tabj extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabs = (TabHost)this.findViewById(R.id.tabs);
tabs.setup();
TabHost.TabSpec one = tabs.newTabSpec("one");
one.setContent(R.id.content1);
one.setIndicator("labelone");
tabs.addTab(one);
TabHost.TabSpec two = tabs.newTabSpec("two");
two.setContent(R.id.content2);
two.setIndicator("labeltwo");
tabs.addTab(two);
}
}
***xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabHost
id="@+id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<FrameLayout
id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="200px"
android:paddingTop="30px"
>
<LinearLayout
id="@+id/content1"
android:orientation ="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff99ccff"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tab item uno
"
/>
</LinearLayout>
<LinearLayout
id="@+id/content2"
android:orientation= "vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffcc99"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tab item dos :/"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="tabhost needs"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="to be upgraded
"
/>
</LinearLayout>
</FrameLayout>
</TabHost>
</LinearLayout>
Please Help....
Thanks


