title: How to load Image in Image View from URL in Round Shape?
body: <p>I have created an android application in that I want to display image in image view from in round shape.</p>
  
  <p>My code is:</p>
  
  <pre><code>    private class LoadImage extends AsyncTask&lt;String, Void, String&gt; 
      {
          Bitmap image=null;
          @Override
          protected String doInBackground(String... params) 
          {
              try 
              {
                  URL url = new URL(imgUrl);
                  image = BitmapFactory.decodeStream(url.openConnection().getInputStream());              
                  image=Global.getRoundedShape(image);                                
              } 
              catch (Exception e) 
              {
                  e.printStackTrace();
              }
              return "Executed";
          }
          @Override
          protected void onPostExecute(String code) 
          {
              try
              {
                  profilepic.setImageBitmap(image);
              }
              catch (Exception e) 
              {
                  e.printStackTrace();
              }
          }    
      }
  
  
  public static Bitmap getRoundedShape(Bitmap scaleBitmapImage) 
  {
      int targetWidth = 168;
      int targetHeight = 166;
      Bitmap targetBitmap = Bitmap.createBitmap(targetWidth, 
                          targetHeight,Bitmap.Config.ARGB_8888);
  
      Canvas canvas = new Canvas(targetBitmap);
      Path path = new Path();
      path.addCircle(((float) targetWidth - 1) / 2,
          ((float) targetHeight - 1) / 2,
          (Math.min(((float) targetWidth), 
          ((float) targetHeight)) / 2),
          Path.Direction.CCW);
  
      canvas.clipPath(path);
      Bitmap sourceBitmap = scaleBitmapImage;
      canvas.drawBitmap(sourceBitmap, 
          new Rect(0, 0, sourceBitmap.getWidth(),
          sourceBitmap.getHeight()), 
          new Rect(0, 0, targetWidth, targetHeight), null);
      return targetBitmap;
  }
  </code></pre>
  
  <p>I use this code, but it takes much load for load Image.</p>
  
  <p>So, is there any option to make it fast ?</p>