title: getting image from gallery but large greater then 3 mb image is not loaded in imageview
body: <blockquote>
    <p>the small images are loaded successully but the large images e,g greater then 3mb are not loaded in image view. i am also capturing image from camera it is working fine,but from gallery it is not loaded in the image view and it remain empty.i do not know how to fix that issue</p>
  </blockquote>
  
  <pre><code> public void gallery() {
      Intent i = new Intent(Intent.ACTION_PICK,
              android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
      startActivityForResult(i, PHOTO_FROM_MEMORY_REQUESTED);
  }
   private void dispatchTakePictureIntent() {
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
          startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
      }
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if( requestCode== REQUEST_IMAGE_CAPTURE) {
          try {
              if (requestCode == REQUEST_IMAGE_CAPTURE &amp;&amp; resultCode == RESULT_OK) {
                  Bundle extras = data.getExtras();
                  Bitmap imageBitmap = (Bitmap) extras.get("data");
                  iv.setImageBitmap(imageBitmap);
                  image = encode(imageBitmap);//this line is added to encode
              }
          }
          catch (Exception e){ Toast.makeText(DoReport.this, e.toString(), Toast.LENGTH_LONG).show();}
      }
      else if (requestCode == PHOTO_FROM_MEMORY_REQUESTED &amp;&amp; resultCode == RESULT_OK) {
          updateSelectedPicture(data.getData());
      }
  
  }
   private void updateSelectedPicture(Uri uri){
      try{
          imageUri = uri;
          InputStream imageStream = getContentResolver().openInputStream(imageUri);
          selectedImage = BitmapFactory.decodeStream(imageStream);
          iv.setImageDrawable(new BitmapDrawable(selectedImage));
          image=encode(selectedImage);
  
      }catch(FileNotFoundException ex){
  
          Log.e("File not found", "Cannot find background file under received URI");
      }
  }
  public static String encode(Bitmap image)
  {
      Bitmap immagex=image;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      immagex.compress(Bitmap.CompressFormat.JPEG, 20, baos);
      byte[] b = baos.toByteArray();
      String imageEncoded = Base64.encodeToString(b,Base64.DEFAULT);
  
      Log.e("LOOK", imageEncoded);
      return imageEncoded;
  }
  </code></pre>
  
  <p>//here is xml code</p>
  
  <pre><code> &lt;ImageView
      android:layout_marginLeft="5dp"
  
      android:layout_width="350dp"
      android:layout_height="197dp"
      android:maxWidth="100dp"
      android:maxHeight="100dp"
      android:layout_below="@+id/toolbar"
      android:id="@+id/ImgView"
      android:layout_centerHorizontal="true"/&gt;
  </code></pre>