Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is that SimpleAdapter don't support Bitmaps by default.</p> <blockquote> <p>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.</p> </blockquote> <p>There is a solution, however. You can set a custom <a href="http://developer.android.com/reference/android/widget/SimpleAdapter.ViewBinder.html" rel="nofollow noreferrer">ViewBinder</a> and make the binding by yourself.</p> <pre><code>class MyViewBinder implements SimpleAdapter.ViewBinder { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { if (view instanceof ImageView &amp;&amp; data instanceof Bitmap) { ImageView v = (ImageView)view; v.setImageBitmap((Bitmap)data); // return true to signal that bind was successful return true; } return false; } } </code></pre> <p>And set this to your SimpleAdapter:</p> <p><code>adapter.setViewBinder(new MyViewBinder());</code></p> <p>This way every time the SimpleAdapter tries to bind a value to a View it first calles your View binder's setViewValue method. If it returns false, it tries to bind it itself.</p> <hr> <p>You can also try to put into your map an URL as a string pointing to the sd card location. I'm not sure however, that the SimpleAdapter can handle this.</p> <hr> <p>Also see this post: <a href="https://stackoverflow.com/questions/4885469/dynamically-show-images-from-resource-drawable">Dynamically show images from resource/drawable</a></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.
 

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