Run UI actions only when the activity is added to the fragment.

This is different from the previous behavior
where we only check if it is not detached.
This commit is contained in:
Torsten Grote
2018-07-20 13:28:34 -03:00
parent aa6b5511c2
commit 6a163c0358

View File

@@ -85,7 +85,7 @@ public abstract class BaseFragment extends Fragment
activity.runOnUiThread(() -> {
// Note that we don't have to check if the activity has
// been destroyed as the Fragment has not been detached yet
if (!isDetached() && !activity.isFinishing()) {
if (isAdded() && !activity.isFinishing()) {
r.run();
}
});