Here's a method that I actually used in an application and I know it works:
try {
URL thumb_u = new URL("http://www.example.com/image.jpg");
Drawable thumb_d = Drawable.createFromStream(thumb_u.openStream(), "src");
myImageView.setImageDrawable(thumb_d);
}
catch (Exception e) {
// handle it
}
I have no idea what the second parameter to Drawable.createFromStream
is, but passing "src"
seems to work. If anyone knows, please shed some light, as the docs don't really say anything about it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…