Я хочу использовать вкладки, но они не работают.Вот мои .java коды:
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec tab1 = tabHost.newTabSpec("tab1");
TabSpec tab2 = tabHost.newTabSpec("tab2");
TabSpec tab3 = tabHost.newTabSpec("tab3");
TabSpec tab4 = tabHost.newTabSpec("tab4");
TabSpec tab5 = tabHost.newTabSpec("tab5");
tab1.setIndicator("menu").setContent(new Intent(this, tab1.class));
tab2.setIndicator("language").setContent(new Intent(this,tab2.class ));
tab3.setIndicator("speaking").setContent(new Intent(this,tab3.class));
tab4.setIndicator("share").setContent(new Intent(this, tab4.class));
tab5.setIndicator("winnig").setContent(new Intent(this,tab5.class ));
tabHost.addTab(tab1);
tabHost.addTab(tab2);
tabHost.addTab(tab3);
tabHost.addTab(tab4);
tabHost.addTab(tab5);
вот мои .xml:
<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost">
<LinearLayout android:id="@+id/LinearLayout01"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
</TabHost>
вот ошибка:
> 01-24 23:48:47.048: E/AndroidRuntime(19837):
> java.lang.RuntimeException: Unable to start activity
> ComponentInfo{com.tasarimprojesi.donem1/com.tasarimprojesi.donem1.user_manual}:
> java.lang.NullPointerException