Android 应用程序中的选项卡出现致命异常
我在运行应用程序时遇到致命异常,并且在模拟器中给出“强制关闭”。
这是LogCat内容,
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 to 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
请指导我如何解决它。
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 to 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
得到了解决方案,
使用 ActivityGroup 而不是 Activity 扩展了我的类,并添加了
tabHost.setup(this.getLocalActivityManager());
Got the solution,
extended my class with ActivityGroup instead of Activity and added
tabHost.setup(this.getLocalActivityManager());