title: Select and crop Image from gallery,Displayed in a Circular Shape Imageview
body: <p>I am trying to fetch Image from Gallery. when user chooses a picture from Gallery, they need to ask crop the Image then the cropped image should be displayed in ImageView.</p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>import android.content.Intent;
  import android.database.Cursor;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.provider.MediaStore;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.Toast;
  
  import java.io.FileNotFoundException;
  import java.io.InputStream;
  
  public class Details extends AppCompatActivity {
      ImageView i1,i2;
      int num =2;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_details);
         android.support.v7.app.ActionBar ab = getSupportActionBar();
         if (ab != null) {
             ab.hide();
         }
         i1 = (ImageView)findViewById(R.id.prof1);
         i2 = (ImageView)findViewById(R.id.prof2);
         i1.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent img_uopload = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                 img_uopload.putExtra("crop","true");
                 img_uopload.putExtra("aspectX",1);
                 img_uopload.putExtra("aspectY",1);
                 img_uopload.putExtra("outputX",200);
                 img_uopload.putExtra("outputY",200);
                 img_uopload.putExtra("return-data",true);
                 startActivityForResult(img_uopload,num);
             }
         });
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if(requestCode == num &amp;&amp; resultCode == RESULT_OK ){
              if(data!=null){
                  Bundle extras = data.getExtras();
                  if(extras !=null){
                      Bitmap img = extras.getParcelable("data");
                      i1.setImageBitmap(img);
                  }
                  else{
                      Toast.makeText(getApplicationContext(),"Not Read",Toast.LENGTH_LONG).show();
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Here the bundle value returns null.</p>
  
  <p>In android manifest, I have included.</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  </code></pre>
  
  <p>UAC :</p>
  
  <ol>
  <li><p>when user clicks image button,Gallery Opens</p></li>
  <li><p>when user chooses image from gallery,He/She should ask to crop the image</p></li>
  <li><p>Cropped Image should placed in ImageView</p></li>
  </ol>
  
  <p>Currently I am not able to use any Github libraries.</p>
  
  <p>After choosing an image user needs to crop the image as like this:</p>
  
  <p><a href="https://i.stack.imgur.com/s6znR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s6znR.jpg" alt="enter image description here"></a></p>
  
  <p>This is my screen:</p>
  
  <p><a href="https://i.stack.imgur.com/ocD7n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ocD7n.jpg" alt="enter image description here"></a></p>