当调用新 Intent 上的 startActivity 时,DialogFragment 正在重新启动

DialogFragment is relaunching itself when startActivity on new Intent is called

在我的 Android 应用程序中,我有一个包含 ListView 的对话框片段。列表视图中项目的 onclick 处理程序调用我的 internalPlayer 方法,该方法调用 VideoView activity 来播放视频。 VideoView activity 在应用程序的其他地方使用,所以我知道它正在工作。

private void internalPlayer(final String channelUrl)
{
    final Intent localIntent = new Intent(getActivity(), InternalVideoActivity.class);
    localIntent.putExtra(EXTRA_VIDEO_URI, Uri.encode(channelUrl, ALLOWED_URI_CHARS).toString());
    localIntent.putExtra(GridViewFragment.CHANNEL_NAME, mCategory.toString() + " Episode ");
    getActivity().startActivity(localIntent);
}

当 运行在平板电脑上安装应用程序时,一切正常,视频 activity 开始并播放视频。当我 运行 设备上的应用程序在 phone 设备上单击 ListView 中的项目时,对话框片段会自行重新启动,并且由于最初传递给它的序列化对象不再存在,因此会抛出 NullPointerException。

这是日志:

04-16 19:34:33.790    6000-6000/com.xystra W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41998700)
04-16 19:34:33.790    6000-6000/com.xystra E/MAIN PHONE ACTIVITY: 1﹕ Unable to start activity ComponentInfo{com.xystra/com.xystra.activity.CatchUpSynopsisActivity}: java.lang.NullPointerException
04-16 19:34:33.814    6000-6000/com.xystra E/MAIN PHONE ACTIVITY﹕ STACK TRACE
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xystra/com.xystra.activity.CatchUpSynopsisActivity}: java.lang.NullPointerException
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740)
            at android.app.ActivityThread.access0(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NullPointerException
            at com.xystra.ui.fragment.ProgramFragment.onCreateView(ProgramFragment.java:369)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
            at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1917)
            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:544)
            at roboguice.activity.RoboFragmentActivity.onStart(RoboFragmentActivity.java:60)
            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
            at android.app.Activity.performStart(Activity.java:5143)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740)
            at android.app.ActivityThread.access0(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)

非常感谢任何帮助或想法。

更多信息

好吧,我摆脱了对话框片段并使用现有的 activity 片段作为我的观点,运行 一些测试并且能够推断出我在底层 activity 由于某种原因导致了这个问题。真的不知道该方法是如何被召回导致异常的。感谢您对评论的所有帮助。