title: I want to show a picture from URL in my recyclerview
body: <p>I have a recyclerview which I populate from an API , there is a URL of a picture I want to show in my imageview, I tried few methods it gives Network Thread exception,</p>
  <p>My Adapter Class,</p>
  <pre><code> @Override
  public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
      ItemPayload model = list.get(position);
      Log.d(&quot;aaa&quot;,model.getTrack().getName().toString());
  
      String image = model.getTrack().getAlbum().getImages().get(position).getUrl();
      URL newurl = null;
      try {
          newurl = new URL(image);
      } catch (MalformedURLException e) {
          e.printStackTrace();
      }
      Bitmap mIcon_val = null;
      try {
          HttpURLConnection conn= (HttpURLConnection)newurl.openConnection();
          conn.setDoInput(true);
          conn.connect();
          int length = conn.getContentLength();
          int[] bitmapData =new int[length];
          byte[] bitmapData2 =new byte[length];
          InputStream is = conn.getInputStream();
          BitmapFactory.Options options = new BitmapFactory.Options();
  
          mIcon_val = BitmapFactory.decodeStream(is,null,options);
  
          holder.songCover.setImageBitmap(mIcon_val);
          
      } catch (IOException e) {
          e.printStackTrace();
      }
  
  
  
      holder.textSong.setText(model.getTrack().getName());
      holder.textArtist.setText(model.getTrack().getArtists().get(0).getName());
      holder.textTrack.setText(model.getTrack().getAlbum().getTotal_tracks().toString());
      String url = model.getTrack().getExternal_urls().getSpotify();
      holder.textSong.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent viewIntent =
                      new Intent(&quot;android.intent.action.VIEW&quot;, Uri.parse(url));
              viewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              context.startActivity(viewIntent);
          }
      });
  
  }
  </code></pre>
  <p>Does Anyone know a easier way to do it? or any fixes?</p>