恢复时的android随机异常无法启动活动ComponentInfo android.content.res.Resources $ NotFoundException

时间:2013-12-02 00:04:24

标签: android android-layout webview layout-inflater inflate-exception

我有一个非常奇怪的异常,当我的应用程序恢复时(在我切换到其他应用程序然后返回我的应用程序之后)会出现这种异常,尽管它不会总是被抛出但只会不时抛出。

异常非常简单的部分。我使用ViewPager(v4)并有两个对话框类,第一个子DialogHelp:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = super.onCreateView(inflater, container, savedInstanceState); [line 50]

第二个父PMDialogFragment(扩展DialogFragment):

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
app = (PMApplication) getActivity().getApplication();

    View view = inflater.inflate(layoutId, container); [line 50]

以及logcat:

    12-02 00:48:04.532: E/AndroidRuntime(22292): FATAL EXCEPTION: main
12-02 00:48:04.532: E/AndroidRuntime(22292): java.lang.RuntimeException: Unable to start activity ComponentInfo{pitersoft.pitermemoflashcards/pitermemo.android.gui.activities.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread.access$600(ActivityThread.java:126)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1155)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.os.Looper.loop(Looper.java:137)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread.main(ActivityThread.java:4482)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at java.lang.reflect.Method.invokeNative(Native Method)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at java.lang.reflect.Method.invoke(Method.java:511)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at dalvik.system.NativeStart.main(Native Method)
12-02 00:48:04.532: E/AndroidRuntime(22292): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.content.res.Resources.getValue(Resources.java:1041)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.content.res.Resources.loadXmlResourceParser(Resources.java:2191)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.content.res.Resources.getLayout(Resources.java:880)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at pitermemo.android.gui.dialogs.PMDialogFragment.onCreateView(PMDialogFragment.java:50)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at pitermemo.android.gui.dialogs.DialogHelp.onCreateView(DialogHelp.java:50)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.Activity.performStart(Activity.java:4475)
12-02 00:48:04.532: E/AndroidRuntime(22292):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1937)
12-02 00:48:04.532: E/AndroidRuntime(22292):    ... 11 more

我真的不知道是什么原因以及如何解决这个问题。如果它总是重复,那就容易多了。

我想也许它与某些喜欢制造问题的WebView组件有关。另一个可疑的事情是onResume的主应用程序我有时运行AsyncTask。但是日志并没有暗示这一点。

你有什么建议可以导致这个吗?提前致谢。 (android min sdk 11,在装有android 4.0.4的设备上运行)。

0 个答案:

没有答案