Android异常篇 java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

Posted 彭老希

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android异常篇 java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState相关的知识,希望对你有一定的参考价值。

   /**
     * 显示实例
     * @param activity 或者 Context 
     */
    public static void showInstance(FragmentActivity activity) 
        Bundle bundle = new Bundle();
        XXXXXDialog dialog = new XXXXXDialog();
        dialog .setArguments(bundle);
        FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
        fragmentTransaction.add(dialog ,"TagXXXX");
        fragmentTransaction.commitAllowingStateLoss();
        //show里面是commit() ---- 换成上面的 commitAllowingStateLoss 就行
        //dialog .show(activity.getSupportFragmentManager(), "TagXXXX");
    

以上是关于Android异常篇 java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState的主要内容,如果未能解决你的问题,请参考以下文章

Java 阻塞和同步队列

Tomcat 之战 - Spring Vaadin 应用程序

IllegalArgumentException: requirement failed: Corrupt index found

将 MutationGroup 流式传输到 Spanner

Android NDK开发篇:Java与原生代码通信(异常处理)

Android NDK开发篇:Java与原生代码通信(异常处理)