Skip to content

Commit 1eca250

Browse files
Martijn CoenenAndroid (Google) Code Review
authored andcommitted
Merge "Fix disableForegroundNdefPush crash." into ics-mr0
2 parents aeb11b5 + deb0f20 commit 1eca250

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/java/android/nfc/NfcFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public static void remove(Activity activity) {
4848
FragmentManager manager = activity.getFragmentManager();
4949
Fragment fragment = manager.findFragmentByTag(FRAGMENT_TAG);
5050
if (fragment != null) {
51-
manager.beginTransaction().remove(fragment).commit();
51+
// We allow state loss at this point, because the state is only
52+
// lost when activity is being paused *AND* subsequently destroyed.
53+
// In that case, the app will setup foreground dispatch again anyway.
54+
manager.beginTransaction().remove(fragment).commitAllowingStateLoss();
5255
}
5356
}
5457

0 commit comments

Comments
 (0)