Search This Blog

Showing posts with label Home Screen Widget. Show all posts
Showing posts with label Home Screen Widget. Show all posts

Tuesday, 17 April 2012

Home screen widget , Weather widget in android

Home-Screen widget are best when your application is running in background and you want to show progress update and related information on home screen.
For example-You are playing song in MediaPlayer and want to show progress on home screen about currently playing song and other information

So for this we need three classes and in the end of this article i have posted full source code link


  • WeatherDataProvider — Our ContentProvider which stores the weather data for this sample. Note that for simplicity, it currently stores the data in memory as opposed to an external and persistent storage such as a file, network location, database, or shared preference.
  • WeatherWidgetProvider — Our AppWidgetProvider which handles specific intent actions (such as when an item is clicked, or the refresh button is pressed). It also sets up the RemoteViews for the widget and binds the service to the collection view in the widget.
  • WeatherWidgetService — Our RemoteViewsService which manages the creation of new factories, which return the RemoteViews for each item in the ListView.   
Screen shot of this application will be like that


Android News and source code