Android Open Source - Easy-Weather-Android-App Widget Provider






From Project

Back to project page Easy-Weather-Android-App.

License

The source code is released under:

GNU General Public License

If you think the Android project Easy-Weather-Android-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.keepiteasy.easyweather;
//from  w  w  w  .j a va  2 s . co m
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.widget.RemoteViews;

public class WidgetProvider extends AppWidgetProvider {
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    ComponentName thisWidget = new ComponentName(context, WidgetProvider.class);
    ConditionsObject conditions = Forecast.getConditionsObject();

    for (int widgetId : appWidgetManager.getAppWidgetIds(thisWidget)) {      
      RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);  
  
      remoteViews.setTextViewText(R.id.tempTextView, conditions.getIcon() + " " + conditions.getTemp() + "K");  
      remoteViews.setTextViewText(R.id.cityTextView, conditions.getCity());

      appWidgetManager.updateAppWidget(widgetId, remoteViews);
    }
  }
}




Java Source Code List

com.keepiteasy.easyweather.AboutActivity.java
com.keepiteasy.easyweather.ConditionsObject.java
com.keepiteasy.easyweather.ConditionsParser.java
com.keepiteasy.easyweather.ErrorActivity.java
com.keepiteasy.easyweather.ForecastObject.java
com.keepiteasy.easyweather.ForecastParser.java
com.keepiteasy.easyweather.Forecast.java
com.keepiteasy.easyweather.LoadingActivity.java
com.keepiteasy.easyweather.LocListener.java
com.keepiteasy.easyweather.WidgetProvider.java