Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The SimpleAdapter expects an integer or string that specifies a resource or image URI:</p> <pre><code>public void setViewImage (ImageView v, String value) Since: API Level 1 </code></pre> <blockquote> <p>Called by bindView() to set the image for an ImageView but only if there is no existing ViewBinder or if the existing ViewBinder cannot handle binding to an ImageView. <strong><em>By default, the value will be treated as an image resource. If the value cannot be used as an image resource, the value is used as an image Uri.</em></strong> This method is called instead of setViewImage(ImageView, int) if the supplied data is not an int or Integer.</p> </blockquote> <p>I believe should use <a href="http://developer.android.com/reference/android/widget/SimpleAdapter.html#setViewBinder(android.widget.SimpleAdapter.ViewBinder)" rel="nofollow noreferrer">setViewBinder</a> to provide a <a href="http://developer.android.com/reference/android/widget/SimpleAdapter.ViewBinder.html" rel="nofollow noreferrer">ViewBinder</a> for the <code>SimpleAdapter</code> to handle binding the <code>Drawable</code> data to the <code>ImageView</code>. Basically, the <a href="http://developer.android.com/reference/android/widget/SimpleAdapter.ViewBinder.html#setViewValue(android.view.View,%20java.lang.Object,%20java.lang.String)" rel="nofollow noreferrer">setViewValue()</a> method should return false unless it is called for your image view. When it is called for your image view, the method should set the data in the view and return true. The return value indicates whether the ViewBinder was able to set the view or whether the adapter should try to bind the data itself via its default behavior.</p> <p>Maybe something like:</p> <pre><code>private final SimpleAdapter.ViewBinder mViewBinder = new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue( final View view, final Object data, final String textRepresentation) { if (view instanceof ImageView) { ((ImageView) view).setImageDrawable((Drawable) data); return true; } return false; } }; ... listSetup .setViewBinder(mViewBinder); </code></pre> <p>I've done a <a href="https://stackoverflow.com/questions/4852828/android-how-to-set-list-item-checked/4852967#4852967">similar thing</a> with a SimpleCursorAdapter and its ViewBinder. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload