title: How to show my all image in image view in android
body: <p>My code is as follows:</p>
  
  <pre><code>public class MainActivity extends Activity {
      ImageView[] targetImage = new ImageView[5];
      private InputStream OpenHttpConnection(String urlString) throws IOException {
          InputStream in = null;
          int response = -1;
          URL url = new URL(urlString);
          URLConnection conn = url.openConnection();
          if (!(conn instanceof HttpURLConnection)) {
              throw new IOException("Not an HTTP connection");
          }
          try {
              HttpURLConnection httpConn = (HttpURLConnection) conn;
              httpConn.setAllowUserInteraction(false);
              httpConn.setInstanceFollowRedirects(true);
              httpConn.setRequestMethod("GET");
              httpConn.connect();
              response = httpConn.getResponseCode();
              if (response == HttpURLConnection.HTTP_OK) {
                  in = httpConn.getInputStream();
              }
          }
          catch (Exception ex) {
              Log.d("Networking", ex.getLocalizedMessage());
              throw new IOException("Error connecting");
          }
  
          return in;
      }
  
      private Bitmap DownloadImage(String URL) {
          Bitmap bitmap = null;
          InputStream in = null;
          try {
              in = OpenHttpConnection(URL);
              bitmap = BitmapFactory.decodeStream(in);
              in.close();
          } catch (IOException e1) {
              Log.d("NetworkingActivity", e1.getLocalizedMessage());
          }
  
          return bitmap;
      }
  
      private class DownloadImageTask extends AsyncTask&lt;String, Bitmap, Long&gt; {
          //---takes in a list of image URLs in String type---
          protected Long doInBackground(String... urls) {
              long imagesCount = 0;
              for ( int i = 0; i &lt; urls.length; i++) {
                  //---download the image---
                  Bitmap imageDownloaded = DownloadImage(urls[i]);
                  if (imageDownloaded != null ) {
                      //---increment the image count---
                      imagesCount++;
                      try {
                          //---insert a delay of 3 seconds---
                          Thread.sleep(3000);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
  
                      //---return the image downloaded---
                      publishProgress(imageDownloaded);
                  }
              }
  
              //---return the total images downloaded count---
              return imagesCount;
          }
  
          //---display the image downloaded---
          protected void onProgressUpdate(Bitmap... bitmap) {
              if(bitmap.length &gt; 0) {
                  for(int i = 0; i &lt; bitmap.length; i++) {
                      targetImage[i].setImageBitmap(bitmap[i]);
                  }
              }
              // tIV[values[i]].setImageBitmap(tBM[values[i]]);
          }
  
          //---when all the images have been downloaded---
          protected void onPostExecute(Long imagesDownloaded) {
              Toast.makeText(getBaseContext(),
              "Total"  + imagesDownloaded + " images downloaded" ,
              Toast.LENGTH_LONG).show();
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          targetImage[0] = (ImageView)findViewById(R.id.target0);
          targetImage[1] = (ImageView)findViewById(R.id.target1);
          targetImage[2] = (ImageView)findViewById(R.id.target2);
  
          new DownloadImageTask().execute(
              "http://solutionboat.com/work_2/asset/images/sobin.jpg" ,
              "http://solutionboat.com/work_2/asset/images/shamol.jpg",
              "http://solutionboat.com/work_2/asset/images/rifat.jpg"
          );
  
          ViewFlipper flipper = (ViewFlipper) findViewById(R.id.viewFlipper1);
          flipper.startFlipping();
      }
  }
  </code></pre>