Reputation: 564
I have built a widget that contains an ImageButton.
How can I access the imagebutton from an AppWidgetProvider and add an click listener on it (to change the color of the button, for example)?
In an Activity I would just use findViewById() and setOnClickListener(), but I can't do that in the AppWidgetProvider.
Upvotes: 2
Views: 596
Reputation: 1007658
How can I access the imagebutton from an AppWidgetProvider and add an click listener on it (to change the color of the button, for example)?
You put the click listener on it when you create it via the RemoteViews
. You cannot access it later. If you wish to change it, update the app widget with a new RemoteViews
.
Upvotes: 1