title: Proper way to update ImageView in a RemoteViews?
body: <p>I'm trying to fetch an image from a remote URL and put it into an ImageView.  The ImageView itself is within an app widget, so from my current understanding that means it is encapsulated within a RemoteViews and isn't really handled directly.</p>
  
  <p>But I can never get the app widget to display an image.  I'm fetching the image as a Bitmap from a remote URL using an AsyncTask extension, and it seems like the image is being fetched OK (a non-null bitmap is returned anyway), though as yet I can't display it to confirm.</p>
  
  <p>I reckon I must be using the wrong method to actually update the app widget's ImageView.</p>
  
  <p>Here is all the relevant code:</p>
  
  <p>layout/new_app_widget.xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:padding="@dimen/widget_margin" &gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/imageView"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:contentDescription="@string/content" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>relevant bit from NewAppWidget.java:</p>
  
  <pre><code>public class NewAppWidget extends AppWidgetProvider {
  
  ...
  
  static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
          int appWidgetId) {
  
      // Construct the RemoteViews object
      RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.new_app_widget);
  
      String strURL = "http://example.com/YqLOSfr4.png";
  
      new ImageFetchAsyncTask(strURL, R.id.imageView).execute();
      // ^^^^^
      // in the above, I pass the URL and the id of the imageview, fetch
      // the bitmap, and in the onPostExecute() method I use
      // setImageViewBitmap(viewId, bitmap) to load the bitmap into the imageview
      // 
      // I don't have the code to hand, but I can provide it.  For now, someone
      // may be able to tell me somewhere else I'm doing something wrong
  
      // Instruct the widget manager to update the widget
      appWidgetManager.updateAppWidget(appWidgetId, views);
  }
  
  }
  </code></pre>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.mike.widgetapptest" &gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          android:debuggable="true"
          &lt;activity
              android:name=".MyActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;receiver android:name=".NewAppWidget" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt;
              &lt;/intent-filter&gt;
  
              &lt;meta-data
                  android:name="android.appwidget.provider"
                  android:resource="@xml/new_app_widget_info" /&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>