DialogFragment.dismiss crashing with NullPointerException

后端 未结 6 2008
慢半拍i
慢半拍i 2021-02-18 13:08

I\'m doing some background work and showing a DialogFragment while I do that. Once my work is done and the relevant callback is invoked, I dismiss the dialog. When I do, I get a

6条回答
  •  被撕碎了的回忆
    2021-02-18 13:20

    My bet would be that the code you posted is from the background thread... you aren't allowed to update the UI from anywhere other than the UI thread.

    You can use onPostExecute() or runOnUiThread() to achieve your goal (if my guess is right about what is happening)

提交回复
热议问题