我在所有活动中都使用相同的菜单,这在所有活动和设备中都运行良好。最近我将 Google Nexus 升级为 Honeycomb,现在,我面临一个奇怪的错误 - 菜单在所有活动中都打开了,除了一个活动。它导致找不到资源。
- 活动没有变化。
- 跨不同活动的相同菜单,为什么仅在一项活动中导致路径错误。
数据管理系统:
04-19 16:03:46.250: E/AndroidRuntime(4269): FATAL EXCEPTION: main
04-19 16:03:46.250: E/AndroidRuntime(4269): android.content.res.Resources$NotFoundException: Resource ID #0x1090045
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.getValue(Resources.java:1018)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2105)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.getLayout(Resources.java:857)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.view.menu.BaseMenuPresenter.getMenuView(BaseMenuPresenter.java:70)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow$PanelFeatureState.getIconMenuView(PhoneWindow.java:3320)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:1096)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:559)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:817)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1486)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1813)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.os.Looper.loop(Looper.java:137)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 16:03:46.250: E/AndroidRuntime(4269): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 16:03:46.250: E/AndroidRuntime(4269): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 16:03:46.250: E/AndroidRuntime(4269): at dalvik.system.NativeStart.main(Native Method)
04-19 16:03:46.257: W/ActivityManager(134): Force finishing activity com.supervalu.mobile.android/.CoupanViewActivity
04-19 16:03:46.781: W/ActivityManager(134): Activity pause timeout for ActivityRecord{41791d08 com.supervalu.mobile.android/.CoupanViewActivity}
在对资源 id 进行挖掘之后 - 我发现根本没有声明并删除它。即使那样,它在相同的资源 id 处显示错误,但现在该资源 id 指向其他视图。