Calling DialogFragment’s show() from within onRequestPermissionsResult() causes IllegalStateException in Marshmallow

The bug is accepted and will be fixed, however, I strongly disagree with the postDelayed and timer solutions. The best way to do this would be introducing a state flag in the Activity, in which you set in the callback, and use in onResume or similar. For example:

private boolean someFlag;

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
// some code checking status
    someFlag = true;
}

And then in onResume:

protected void onResume() {
    if(someFlag == true) {
        doSomething();
        someFlag = false;
    }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)