Null Pointer Exception when Drawing an image
问题 I am having a problem with setting an ImageView image to an image which has been fetched from a URL. Here is the method used to turn the URL into a Drawable object: private Drawable LoadImage(String url){ try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src"); return d; }catch (Exception e) { System.out.println("Exc="+e); return null; } } Here is the code to call the method: Drawable drawable = LoadImage("www.myurl.com/image.jpg");