0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DialogFragment.dismissAllowingStateLossについて

Posted at

はじめに

DialogFragmentを使用していたところ、エラーでクラッシュしていたので調べたのでそれについての記事です。

解決

エラー内容的には、DialogFragmentを表示し、非同期で何か通信などをした後にDialogFragmentを閉じると出るエラーみたいで、dismissではなく解決法が記事のタイトルにもあるdismissAllowingStateLossを使うことでした。

使い方は、dismissと同じなのでClick処理にやりたい処理とdismissAllowingStateLossをつけるだけです。

    〜〜〜.setOnClickListener { 
      dismissAllowingStateLoss()
      // やりたい処理
    }

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?