public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_bottom); TabHost host=(TabHost)findViewById(android.R.id.tabhost); TabSpec firstTabSpec = host.newTabSpec("tab1"); TabSpec secondTabSpec = host.newTabSpec("tab2"); TabSpec thirdTabSpec = host.newTabSpec("tab3"); // TabSpec threeTabSpec = host.newTabSpec("tid1");
firstTabSpec.setIndicator("Start"); firstTabSpec.setContent(new Intent(this,Main.class)); secondTabSpec.setIndicator("Activities"); secondTabSpec.setContent(new Intent(this,AccRecord.class)); thirdTabSpec.setIndicator("Settings"); thirdTabSpec.setContent(new Intent(this,EditPreferences.class)); Log.d(LOG_TAG, "여기까지되요"); // threeTabSpec.setIndicator(""); // threeTabSpec.setContent(new Intent(this,History.class));
Log.d(LOG_TAG, "여기서부터 막힘"); host.addTab(firstTabSpec); host.addTab(secondTabSpec); host.addTab(thirdTabSpec);
addTab하는 부분에서
04-24 10:28:25.887: W/dalvikvm(476): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-24 11:18:08.507: E/AndroidRuntime(567): java.lang.RuntimeException: Unable to start activity ComponentInfo
{smartwalker.main/smartwalker.main.Main_Tab}: java.lang.RuntimeException: Unable to start activity ComponentInfo
{smartwalker.main/smartwalker.main.Main}: java.lang.NullPointerException
Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{smartwalker.main/smartwalker.main.Main}:
java.lang.NullPointerException
에러가 이렇게 뜹니다. 이전까지 실행이 되다가 갑자기 이러네요.
메니패스트 에는
<activity android:name=".Main" />
<activity android:name=".EditPreferences"/>
<activity android:name=".AccRecord" />
이렇게 인텐트하는 액티비티가 모두 정의되어있고.
이게 xml 부분입니다.
<?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" 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="wrap_content" > </FrameLayout> </LinearLayout> </TabHost>
어떻게 해야될지 모르겠습니다.
아시는분 좀 도와주세요 ㅠ.ㅠ 고수님 도와주세요~