So the title slightly misleading. I've put the URl in a drawable.
public Drawable getDrawableFromURL(String url) {
try {
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
} catch (Exception e) {
return null;
}
}
I had it has a bitmap originally but kept getting nullpointers and android.os.NetworkOnMainThreadException
, which I've managed to fix, but the nullpointer comes around again. So I'm stuck on how to save to internal, because I can save it to SD fine.
Thanks