嗨,我创建了一个简单的选项卡活动,但它不起作用,我需要一些帮助,我知道我在某处犯了一些愚蠢的错误..请帮助大家..在下面给出我的 logcat
10-28 03:44:22.772: E/AndroidRuntime(1119): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.friendfinder/com.friendfinder.TabActivityLayouts}:
java.lang.IllegalArgumentException: you must specify a way to create the tab indicator.
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.os.Handler.dispatchMessage(Handler.java:99)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.os.Looper.loop(Looper.java:137)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
android.app.ActivityThread.main(ActivityThread.java:5103)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
java.lang.reflect.Method.invokeNative(Native Method)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
java.lang.reflect.Method.invoke(Method.java:525)
10-28 03:44:22.772: E/AndroidRuntime(1119): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
在下面给出我的标签活动类..
public class TabActivityLayouts extends TabActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome_form);
TabHost tabhost= getTabHost();
TabSpec spec=tabhost.newTabSpec("Welcome");
spec.setIndicator("w", getResources().getDrawable(R.drawable.new_tab1));
Intent in=new Intent(this,WelcomeTabActivity.class);
spec.setContent(in);
TabSpec specific=tabhost.newTabSpec("Friends");
spec.setIndicator("s", getResources().getDrawable(R.drawable.new_tab2));
Intent i=new Intent(this,FriendsListTabActivity.class);
spec.setContent(i);
tabhost.addTab(spec);
tabhost.addTab(specific);
}
}