收到以下错误:
Caused by java.lang.IllegalStateException: Fragment already added: f{83e932d #2 f}
at androidx.fragment.app.FragmentManagerImpl.addFragment + 1916(FragmentManagerImpl.java:1916)
at androidx.fragment.app.BackStackRecord.executeOps + 765(BackStackRecord.java:765)
at androidx.fragment.app.FragmentManagerImpl.executeOps + 2625(FragmentManagerImpl.java:2625)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether + 2411(FragmentManagerImpl.java:2411)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute + 2366(FragmentManagerImpl.java:2366)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions + 2273(FragmentManagerImpl.java:2273)
at androidx.fragment.app.FragmentController.execPendingActions + 391(FragmentController.java:391)
at androidx.fragment.app.FragmentActivity.onResume + 517(FragmentActivity.java:517)
at com.mandarine.sai.features.main.MainActivity.onResume + 73(MainActivity.java:73)
at android.app.Instrumentation.callActivityOnResume + 1259(Instrumentation.java:1259)
at android.app.Activity.performResume + 6408(Activity.java:6408)
at android.app.ActivityThread.performResumeActivity + 3116(ActivityThread.java:3116)
at android.app.ActivityThread.handleResumeActivity + 3158(ActivityThread.java:3158)
at android.app.ActivityThread$H.handleMessage + 1404(ActivityThread.java:1404)
at android.os.Handler.dispatchMessage + 102(Handler.java:102)
at android.os.Looper.loop + 148(Looper.java:148)
at android.app.ActivityThread.main + 5458(ActivityThread.java:5458)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 738(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main + 628(ZygoteInit.java:628)
这是我在MainActivity
中的代码:
override fun onResume() {
super.onResume()
this.applyPreferenceLocale()
}
第73行:super.onResume()