Update UI in Android
There are many activities in my application and one subclass of Application (ApplicationEx class). My application send and receive SIP messages. If new message is received then there is a callback of message received in ApplicationEx class. From ApplicationEx class how to inform UI (specific activity) ? And for every message it is not efficient to broadcast intent as per this开发者_如何转开发 link. Which methods available to update UI ? and which method suits for this application ?
I used handler to update UI. To update UI I override handleMessage method of Handler.Callback.
I would recommed registering a listener (ie. create an OnDirtyViewListener
) and have your Activity
register to it. Then when the Application
deems the View
is dirty, fire off the call and have the Acitvity
postInvalidate()
its top level View
.
精彩评论