java.lang.IllegalStateException:在片段中的onSaveInstanceState之后无法执行此操作

时间:2019-01-16 15:41:30

标签: android android-fragments

我正在开发一个新的应用程序。当用户单击片段内的继续按钮时,应用程序崩溃,并显示以下错误:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
        at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:2080)
        at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:2106)
        at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:683)
        at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:637)
        at ru.terrakok.cicerone.android.SupportFragmentNavigator.applyCommand(SupportFragmentNavigator.java:82)
        at ru.terrakok.cicerone.android.SupportAppNavigator.applyCommand(SupportAppNavigator.java:77)
        at ru.terrakok.cicerone.CommandBuffer.executeCommand(CommandBuffer.java:43)
        at ru.terrakok.cicerone.BaseRouter.executeCommand(BaseRouter.java:31)
        at ru.terrakok.cicerone.Router.navigateTo(Router.java:84)
        at com.empowered.healo.ui.screens.pain_profile.PainProfileFragment$initUI$6.onClick(PainProfileFragment.kt:267)
        at android.view.View.performClick(View.java:6205)
        at android.widget.TextView.performClick(TextView.java:11103)
        at android.view.View$PerformClick.run(View.java:23653)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6682)
        at java.lang.reflect.Method.invoke(Native Method)

下面我显示了导致错误的方法:

tvContinue.setOnClickListener {
    val data = Bundle()

    data.putString(THERAPY_INFO, "THERAPY_INFORMATION")
    router.navigateTo(Screen.THERAPY_INFO, data )
}

0 个答案:

没有答案