title: Cannot get image from URL either using url.openConnection or Picasso in Android
body: <p>I am trying to fetch images from URLs in ArrayAdapter class but not successful. I get an error message but it is null. Any suggestions to debug it? Thanks.</p>
  
  <p>If try to get images using url.openConnection</p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ...
      ArrayList&lt;String&gt; imageFiles = post.imageFiles;
      for (int i = 0; i &lt; imageFiles.size(); i++) {
          try {
              ImageView imageView = new ImageView(context);
              URL url = new URL(imageFiles.get(i));
              Log.d("DEBUGA1-ImageURL", post.imageFiles.get(i));
              Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
              imageView.setImageBitmap(bmp);
              Log.d("DEBUGA1-Successful: ", "");
          } catch (Exception e) {
              Log.d("DEBUGA1-Error: ", e.getLocalizedMessage() == null ? "error is null message" : e.getLocalizedMessage());
          }
      }
      ...
  }
  </code></pre>
  
  <p>Print</p>
  
  <pre><code>D/DEBUGA1-ImageURL: http://lc-IDX4LztP.cn-n1.lcfile.com/dovltUTrQUMvYA2FlPnLLAD
  D/DEBUGA1-Error:: error is null message
  D/DEBUGA1-ImageURL: http://lc-IDX4LztP.cn-n1.lcfile.com/KLGH4UDPqfq0PN2rqJhBK5D
  D/DEBUGA1-Error:: error is null message
  D/DEBUGA1-ImageURL: http://lc-IDX4LztP.cn-n1.lcfile.com/b5eiDFQGYSIf6IYC2xLISZB
  D/DEBUGA1-Error:: error is null message
  D/DEBUGA1-ImageURL: http://lc-IDX4LztP.cn-n1.lcfile.com/ve00QyIrnuHCkHa0bKbcNAD
  D/DEBUGA1-Error:: error is null message
  D/DEBUGA1-ImageURL: http://lc-IDX4LztP.cn-n1.lcfile.com/RR2CRPN1DqrhiNjeEBauL8B
  D/DEBUGA1-Error:: error is null message
  </code></pre>
  
  <p>If try to get images using Picasso, no any response from either onSuccess or onError. Wondering why</p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ...
      ImageView imageView = new ImageView(context);
      ArrayList&lt;String&gt; imageFiles = post.imageFiles;
      for (int i = 0; i &lt; imageFiles.size(); i++) {
          Picasso.with(context).load(imageFiles.get(i))
                  .error(R.mipmap.ic_launcher)
                  .fit()
                  .centerInside()
                  .into(imageView, new com.squareup.picasso.Callback() {
                      @Override
                      public void onSuccess() {
                          Log.d("DEBUGA2-Successful: ", "");
                      }
                      @Override
                      public void onError() {
                          Log.d("DEBUGA2-error", "onError");
                      }
                  });
      }
      ...
  }
  </code></pre>