Note that there are some explanatory texts on larger screens.

plurals
  1. PO"resolveUri failed on bad bitmap uri" when putting image on ListView
    text
    copied!<p>hey, i'm new to android and i have a slight problem. i'm trying to put together a listview with images are loaded through a URL. this works so far, but the images wont show up. logcat says this:</p> <pre><code>02-23 19:20:48.447: INFO/System.out(833): resolveUri failed on bad bitmap uri: android.graphics.drawable.BitmapDrawable@405359b0 </code></pre> <p>its obviously not finding my image, but i have no idea why. using R.drawable.icon works though. can anyone help me out? heres my source:</p> <pre><code>public class Main extends Activity { private ListView lv_main; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); lv_main = (ListView) findViewById(R.id.listviewmain); ArrayList&lt;HashMap&lt;String, String&gt;&gt; listItem = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String,String&gt; map; map = new HashMap&lt;String, String&gt;(); map.put("title", "a title goes here"); map.put("details", "details blaa"); map.put("cover", String.valueOf(Main.this.LoadImageFromWebOperations("http://www.google.com/intl/en_ALL/images/srpr/logo1w.png")); //THIS WORKS FINE: map.put("cover", String.valueOf(R.drawable.icon)); listItem.add(map); map = new HashMap&lt;String, String&gt;(); map.put("title", "2nd title"); map.put("details", "more details"); map.put("cover", String.valueOf(Main.this.LoadImageFromWebOperations("http://www.google.com/images/srpr/nav_logo37.png")); //THIS WORKS FINE: map.put("cover", String.valueOf(R.drawable.icon)); listItem.add(map); SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.listviewitem, new String[] {"cover", "title", "details"}, new int[] {R.id.cover, R.id.title, R.id.details}); lv_main.setAdapter(mSchedule); } public Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; }catch (Exception e) { System.out.println("Exc="+e); return null; } } } </code></pre> <p>thanks in advance. rob</p>
 

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