Android 应用程序中的选项卡出现致命异常

发布于 2024-11-26 23:23:15 字数 2807 浏览 1 评论 0原文

我在运行应用程序时遇到致命异常,并且在模拟器中给出“强制关闭”。

这是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫弦 2024-12-03 23:23:15

得到了解决方案,
使用 ActivityGroup 而不是 Activity 扩展了我的类,并添加了

tabHost.setup(this.getLocalActivityManager());

Got the solution,
extended my class with ActivityGroup instead of Activity and added

tabHost.setup(this.getLocalActivityManager());

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文