Reputation: 124
I need to update views in activity every 1-2 seconds with data that i must get from the other thread. How can i do that ? I was reading about broadcast receiving, but i can`t imagine how to do that in my case. Can you ,please , give me some example with it, hope with comments ) Thanks, P.S. Sorry for clumsy english.
Upvotes: 0
Views: 574
Reputation: 7634
You can pass a handler object from the activity to the thread. Once the work in the thread is over you can message the activity with the handler object. In the activity, you can update the UI as soon as the message is received. For more info on handlers refer http://developer.android.com/reference/android/os/Handler.html
Upvotes: 1