So I have a bit of experience building android applications. But now i would like to build a widget for android that would sit on the home screen and display a button, and when the button is pressed it plays a sound. I’ve been looking at tutorials online on how to set up an android widget but i cant seem to figure it out. Are there any good tutorials out there on how to make a standalone widget this simple or somewhere i can start?
Thanks in advance,
Peter
So I have a bit of experience building android applications. But now i would
Share
first Create a new layout file inside res/layout, under the project structure, that will define the widget layout (widgetlayout.xml) according to the following structure.
Create the res/xml folder under the project structure
Create a xml file (widgetproviderinfo.xml) with the following parameters:
Now you should create the service that reacts to the user interaction with the smiley image button (CurrentMoodService.java).
After defining the service, it is time to implement the widget provider class (CurrentMoodWidgetProvider.java).
Finally it is necessary to declare the Service and the
AppWidgetProviderin the Manifest (AndroidManifest.xml).and if you want to download the whole source code then have a look at the url below…
http://sites.google.com/site/androidsourcecode/src/CurrentMoodWidgetProject.rar?attredirects=0