Fix java.lang.IllegalStateException

ix java.lang.IllegalStateException: allow state loss when showing dialog