what can the updateAppWidget function do?
In the Widget project ,I call the updateAppWidget function.Then the widget project is updated. I want to kown how can the widget project is up开发者_如何学编程dated? The onReseive() function is called? Thanks!
When you call updateAppWidget you are setting a widget ID and RemoteViews
. RemoteViews
is a content of your widget. You can inflate it from resources, set text to items, add on click listenters (not regular ones, but trough PendingIntent
's), etc...
Then AppWidgetManager
draws/updates your widget using its ID and supplied RemoteViews
onReceive is called in another cases, i.e. then some broadcast intent is sent from a click on widget's button or any other event.
精彩评论