Prevent crash

pull/160/head
M66B 5 years ago
parent eeda538546
commit 73e4f2c4f9

@ -4,8 +4,10 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_CANCELED;
@ -21,6 +23,17 @@ public class FragmentDialogEx extends DialogFragment {
} }
} }
@Override
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
try {
super.show(manager, tag);
} catch (IllegalStateException ex) {
// Can not perform this action after onSaveInstanceState
// Should not happen, but still happened in AdapterMessage.onOpenLink
Log.w(ex);
}
}
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
sendResult(RESULT_CANCELED); sendResult(RESULT_CANCELED);

Loading…
Cancel
Save