Android activate gps with AlertDialog: how to wait for the user to take action?

后端 未结 5 784
春和景丽
春和景丽 2020-12-17 20:18

I\'ve read different posts that there is no way to wait for the user to take an action when an AlertDialog is shown because it blocks the UI.

However,

5条回答
  •  情深已故
    2020-12-17 21:12

    (sorry for my english) I was shearing for a solution when i saw your question and your question give the answer.

    The problem is that the activity continue the launching while the dialog alert is open, and when the user press "YES" a new activity will start "Settings of gps.." when the user back to the first activity after setting ON his gps or just ignored you, this same activity will not do any update or consider that something (like gps on) has happen because it's already loaded, so you have to listen to the updates and apply changes or just restart the activity when the user "back" , for me i just added :

     
    

    now, everytime the user press the "Back button" your activity will restart considering the new updates it worked for me, hope that this can help you or helpl anyone else

提交回复
热议问题