Android: “BadTokenException: Unable to add window; is your activity running?” at showing dialog in PreferenceActivity

前端 未结 6 1094
-上瘾入骨i
-上瘾入骨i 2021-01-30 16:06

I\'d like to ask for some help: In my app, I have only one activity, a PreferenceActivity (don\'t need other, it\'s just a simple background-sync app, so the

6条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 16:35

    The top solution only prevents the crash. For me the problem was that I had referred a wrong context to show the alert dialog. After passing the correct context, the problem was solved.

提交回复
热议问题