Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment 1.2.0-rc01 release.
Description
Version used: 1.0.2
Devices/Android versions reproduced on: I did not reproduce it myself but I do have stack traces from Samsun/Huawei/Xiaomi Android 8 and 9
DialogInterface param of DialogFragment.onDismiss() function is marked as @NonNull
```
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
if (!mViewDestroyed) {
// Note: we need to use allowStateLoss, because the dialog
// dispatches this asynchronously so we can receive the call
// after the activity is paused. Worst case, when the user comes
// back to the activity they see the dialog again.
dismissInternal(true);
}
}
```
...but I've seen crashes in my app with stack traces showing that this param was null
```
Fatal Exception: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method l.w.d.j.b, parameter dialog
at com.my.app.ui.dialog.MyCustomDialog.onDismiss + 88(MyCustomDialog.java:88)
at android.app.Dialog$ListenersHandler.handleMessage + 1503(Dialog.java:1503)
at android.os.Handler.dispatchMessage + 105(Handler.java:105)
at android.os.Looper.loop + 164(Looper.java:164)
at android.app.ActivityThread.main + 6944(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run + 327(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main + 1374(ZygoteInit.java:1374)
```
Dialog source code shows that the DialogInterface can be indeed null
This is kind of problematic because the app written in Kotlin crashes and you can't really fix this without using Java code.
Kotlin does not allow us to mark DialogInterface as a nullable value.