Getting Fatal Exception with Tabs in Android application
I am getting Fatal Exception while running the application and in Emulator it gives "Force Close".
Here is the LogCat content,
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): FATAL EXCEPTION: main
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demotab/com.demotab.DemotabActivity}: java.lang.IllegalStateException: Did you forget t开发者_运维问答o call 'public void setup(LocalActivityManager activityGroup)'?
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.os.Handler.dispatchMessage(Handler.java:99)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.os.Looper.loop(Looper.java:123)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at java.lang.reflect.Method.invokeNative(Native Method)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at java.lang.reflect.Method.invoke(Method.java:521)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at dalvik.system.NativeStart.main(Native Method)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): Caused by: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:649)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.widget.TabHost.setCurrentTab(TabHost.java:323)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.widget.TabHost.addTab(TabHost.java:213)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at com.demotab.DemotabActivity.onCreate(DemotabActivity.java:36)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-28 22:01:14.567: ERROR/AndroidRuntime(11421): ... 11 more
Please guide me how can I resolve it.
Got the solution, extended my class with ActivityGroup instead of Activity and added
tabHost.setup(this.getLocalActivityManager());
精彩评论