I have already done one android application which stores date with person name and phone number.
Now I have to develop one widget for this application to show today's (date, person name, and phone number) with button.
Requirements:
- Single application with app and widget.
- When I click on a button which is in the widget, it will start my application.
- Widget data should always synchronize with my app - when today's day (person 5 and application add 5 more person then widget display 10 person data)
- How can I design this widget? Any guidelines? I have to use horizontal ScrollView.
I have done a simple widget demo but I don't know how to synchronize it with my application.
Please share your experience and give some idea about my widget and application.
I am finding couple of days I got somehow the solution. So I am sharing my idea.
This site has been very useful for me.
http://kasperholtze.com/android/how-to-make-a-simple-android-widget/
I made some changes and did my work.
Requirement solution:
1. Make Receiver and put into manifest permission like this.
2. In my side require top TextView click so can make using TextView id in
onUpdate()
.3. I want to call database and fetch record and display it. Now question what about update?
So I have used timer class and run every 1000sec because of over widget is always update 30min(may be).
If any have queries then put a comment and thanks to all who gave me full support to make this answer useful.
Create and configure widget
You also specify the meta-data for the widget via the android:name="android.appwidget.provider attribute. The configuration file referred by this meta-data contains the configuration settings for the widget. If contains for example the update interface, the size and the initial layout of the widget.
Create a new file myshape.xml in the /res/drawable directory. This file will define the background we use in your widget.
Define the following
widget_layout.xml
file under the res/layout folder.now make the class.