android - How to convert an image from URL to Drawable -
i'm having problem converting image drawable object. i'm converting image using:
public drawable loadimagefromweboperations(string url) { try { inputstream = (inputstream)new url(url).getcontent(); drawable d = drawable.createfromstream(is, "src name"); return d; } catch (exception e) { system.out.println("exc=" + e); return null; } } i'm trying put drawable in hashmap , insert listadapter, value of drawable android.graphics.drawable.bitmapdrawable@405359b0 instead of integer , message in logcat
resolveuri failed on bad bitmap uri".
this how put drawable in hashmap:
map.put("cover", string.valueof( main.this.loadimagefromweboperations("http://www.asdfasfs.com/dasfas.jpg")));
why expect drawable integer? object can assign imageview.
there items in project can refer id, true, else.
r.drawable.icon not drawable, in same sense r.view.your_button not button. call getviewfromid() on that. if have function works this:
dosomethingwithview(r.view.id); then not work (pseudocode ofcourse)
myview = new button(); dosomethingwithview(myview); so if function works r.drawable.id, highly unlikely works drawable (except overloading ofcourse).
Comments
Post a Comment