인터넷에서 본 내용을 토대로 탭만 만들어서 실행시켜봤는데요..
에러가 발생하는데 뭐가 문제인지
logcat은 어케 봐야하는지 모르겠네요..
고수님들 도와주세요..
- xml -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
</FrameLayout>
</TabHost>
</LinearLayout>
- 소스 -
package s1.m1.ShesMusic;
import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.widget.TabHost;
public class SMActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
tabHost.setup();
View v = (View)findViewById(R.id.tab1);
TabHost.TabSpec spec = tabHost.newTabSpec("tag1");
spec.setContent(R.id.tab1); // => 여기서 에러 발생합니다..
spec.setIndicator("1");
tabHost.addTab(spec);
spec = tabHost.newTabSpec("tag2");
tabHost.addTab(spec.setContent(R.id.tab2).setIndicator("2"));
tabHost.setCurrentTab(0);
}
}
브레이크를 찍어서 F6으로 1단계씩 지나가다보면 spec.setContent에서 에러가 발생해서
이상한 창으로 이동되네요..
Debug 창에서는
ActivityThread.performLaunchAcitivity(ActivityThread$ActivityClientRecord, Intent) line : 1620
으로 나오고요..
로그캣을 보면 좋다는데 로그캣을 볼줄은 몰라서..
어케 봐야하는지 ㅠ.ㅠ
MFC만 개발하다가 이클립스로 안드로이드 개발할려니 모르는게 많네여..




자답 - 이클립스가 이상했었나 봅니다..
싹 지우고 다시 설치하니 잘되네요 ㅠ.ㅠ
아.. 안드로이드 초보라 안그래도 힘든뎅.. ㅠ.ㅠ
근데 이상한게 Android SDK를 업데이트 했는데 API Level 9가 없어졌네요..
전에는 API Level 9 로 만들었었거든요..