I respond to a button press on my appwidget in the onreceive method. When the button I pressed, I want to force the widget to call the onupdate method. How do I accomplish this?
Thanks in advance!
I respond to a button press on my appwidget in the onreceive method. When the button I pressed, I want to force the widget to call the onupdate method. How do I accomplish this?
Thanks in advance!
This is kinda crude, but it works rather well for me, as I've found no directly-implemented way to force an update.
Now, anywhere I want to force the widget to update, it's as simple as:
Widget can't actually respond to clicks because it's not a separate process running. But it can start service to process your command:
You should also register the new service in your manifest file:
You can find another example of UpdateService implementation in Wiktionary sample in SDK
And here's another good approach Clickable widgets in android