title: How can we change the image of a widget button?
body: <p>i"m trying to find a way to change the image of the button i order to show the current state of the application.</p>
  
  <p>this is what i have done so far...</p>
  
  <p><strong>HelloWidgetProvider.java</strong></p>
  
  <pre><code>public class HelloWidgetProvider extends AppWidgetProvider {
  
  
  
  @Override
  public void onDeleted(Context context, int[] appWidgetIds) {
  // TODO Auto-generated method stub
  //super.onDeleted(context, appWidgetIds);
  Toast.makeText(context, "onDeleted()", Toast.LENGTH_LONG).show();
  }
  
  @Override
  public void onDisabled(Context context) {
  // TODO Auto-generated method stub
  //super.onDisabled(context);
  Toast.makeText(context, "onDisabled()", Toast.LENGTH_LONG).show();
  }
  
  
  
  @Override
  public void onEnabled(Context context) {
  // TODO Auto-generated method stub
  //super.onEnabled(context);
  Toast.makeText(context, "onEnabled()", Toast.LENGTH_LONG).show();
  }
  
  public static String MY_WIDGET_UPDATE = "MY_OWN_WIDGET_UPDATE";
  
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
   int[] appWidgetIds) {
  // TODO Auto-generated method stub
  
  
  CharSequence strWidgetText = "App Status";
  
  RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.hellowidget_layout);
  
  updateViews.setTextViewText(R.id.widgettext, strWidgetText);
  appWidgetManager.updateAppWidget(appWidgetIds, updateViews);
  
  super.onUpdate(context, appWidgetManager, appWidgetIds);
  Toast.makeText(context, "onUpdate()", Toast.LENGTH_LONG).show();
  
   }
  
  
  
  
  @Override
   public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    super.onReceive(context, intent);
  
  //  if(MY_WIDGET_UPDATE.equals(intent.getAction())){
     Toast.makeText(context, "onReceiver()", Toast.LENGTH_LONG).show();
    //}
   }
  
  }
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p><strong>hellowidget_layout.xml</strong></p>
  
  <pre><code>&lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="wrap_content"
   android:layout_height="fill_parent"
   &gt;
  &lt;Button
  android:id="@+id/widgettext"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:textColor="#000000"
   android:background="@drawable/icon"
   android:text="Test Button"
   /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>hellowidgetproviderinfo.xml</strong></p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;appwidget-provider
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:minWidth="146dp"
      android:minHeight="72dp"
      android:updatePeriodMillis="1000"
      android:initialLayout="@layout/hellowidget_layout"
  &gt;
  &lt;/appwidget-provider&gt;
  </code></pre>
  
  <p>Please help me....
  Thanks</p>