java - Threads and UserInterface interaction -
i'm trying make app lets user log location web server, i'm stuck in flow of this. i'm using threads confusing @ point how best use them this. on main thread(1) there ui , user hits button log location, after hitting button, ui thread shows "please wait" dialog box , starts new thread(2) acquire gps location. understand right now: ui thread stuck showing dialog box , thread(2) getting location. next when thread(2) done geting location, need thread(3) communicate http server. understand it, main thread(1) can't deal "sleep()" periodically check on flags other threads set it. way dismiss "please wait" dialog 1 of threads. guys can see i'm little confused. best way address (strictly talking thread synchronization)? need user interface shows please wait dialog while in background app 1st getting gps coordinates , 2nd, after getting location logging on web server. , showing success or not user. thanks!
you can use asynctask
@vikram commented. activity.runonuithread()
option. view.post()
yet another.
Comments
Post a Comment