title: How can I download and set an Image on a ImageView on Android app?
body: <p>Hi guys surfing the internet I found some snippet to download and set an Image on a ImageView on Android. But it seems that doesn't works because it don't find the resource... Here is my snippet</p>
  
  <pre><code>String user_image_url = "http://www.nuoto.it/foto_news/papera";
  URL url;
  try {
      url = new URL(user_image_url);
      HttpURLConnection conn;
      try {
          conn = (HttpURLConnection) url.openConnection();
          conn.setDoInput(true); 
          conn.connect();
          InputStream is;
          is = conn.getInputStream();
          Bitmap bmImg = BitmapFactory.decodeStream(is);
      } catch (IOException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
  }   
  
  
  String uri = "@drawable-hdpi/bg_main.png";
  int imageResource = getResources().getIdentifier(uri, null, getPackageName()); //Here it give me the error (Resource not found)
  
  ImageView imageview = (ImageView)v.findViewById(R.id.place_image);
  Drawable res = getResources().getDrawable(imageResource);
  imageview.setImageDrawable(res);
  } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>
  
  <p>Thank you so much</p>
  
  <p>Logcat for @Hunkeone:</p>
  
  <pre><code>10-13 16:55:57.926: E/AndroidRuntime(4380): FATAL EXCEPTION: main
  10-13 16:55:57.926: E/AndroidRuntime(4380): Process: com.example.findmyclients, PID: 4380
  10-13 16:55:57.926: E/AndroidRuntime(4380): java.lang.NullPointerException
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at android.content.ContextWrapper.getResources(ContextWrapper.java:94)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.example.findmyclients.BuildInfoMatrix.Read_Matrix(BuildInfoMatrix.java:172)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.example.findmyclients.WindowFeature.show(WindowFeature.java:51)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.example.findmyclients.MainActivity$7.onInfoWindowClick(MainActivity.java:679)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.android.gms.maps.GoogleMap$9.e(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.android.gms.maps.internal.f$a.onTransact(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at android.os.Binder.transact(Binder.java:361)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.android.gms.maps.internal.ai.a(SourceFile:82)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.c.ae.h(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.c.g.b(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.o.bo.aK_(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.o.bo.a(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.o.ca.c(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.o.am.onSingleTapConfirmed(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.i.g.onSingleTapConfirmed(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.google.maps.api.android.lib6.gmm6.i.i.handleMessage(Unknown Source)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at android.os.Handler.dispatchMessage(Handler.java:102)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at android.os.Looper.loop(Looper.java:146)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at android.app.ActivityThread.main(ActivityThread.java:5602)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at java.lang.reflect.Method.invokeNative(Native Method)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at java.lang.reflect.Method.invoke(Method.java:515)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
  10-13 16:55:57.926: E/AndroidRuntime(4380):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>