MainActivity: attempt to fix commit state exceptions
This is an attempt to fix: java.lang.IllegalStateException: at android.support.v4.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:2053) at android.support.v4.app.FragmentManagerImpl.enqueueAction (FragmentManager.java:2079) at android.support.v4.app.BackStackRecord.commitInternal (BackStackRecord.java:678) at android.support.v4.app.BackStackRecord.commit (BackStackRecord.java:632) at com.wireguard.android.activity.MainActivity.moveToState (MainActivity.java:58) at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.java:157) at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.java:75) at com.wireguard.android.fragment.BaseFragment.setSelectedTunnel (BaseFragment.java:82) at com.wireguard.android.fragment.TunnelListFragment.lambda$null$4$TunnelListFragment (TunnelListFragment.java:307) at com.wireguard.android.fragment.TunnelListFragment$$Lambda$4.onClick (Unknown Source:6) at android.view.View.performClick (View.java:6274) at android.view.View$PerformClick.run (View.java:24729) at android.os.Handler.handleCallback (Handler.java:789) at android.os.Handler.dispatchMessage (Handler.java:98) at android.os.Looper.loop (Looper.java:169) at android.app.ActivityThread.main (ActivityThread.java:6595) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767) But this is probably the wrong way to fix it and instead moveToState needs to be reimagined. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
d7889c4e88
commit
2db2a0921d
@ -55,7 +55,7 @@ public class MainActivity extends BaseActivity {
|
||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
||||
if (state.layer > 0)
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
transaction.commitAllowingStateLoss(); /* TODO: switch back to .commit() when this function is rewritten. */
|
||||
} else if (nextState.layer == state.layer - 1) {
|
||||
if (fragmentManager.getBackStackEntryCount() == 0)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user