title: how i can limit size image selected
body: <p>My problem's  the consumption memory, I need limit size the image selected.  </p>
  
  <p><strong>Edit</strong></p>
  
  <p>I don't need to resize image after load, I can resize image using </p>
  
  <pre><code>Bitmap.createScaledBitmap(image, (int) 80, (int) 80, true);
  </code></pre>
  
  <p>I need to prevent user select images > 5 MB</p>
  
  <p><strong>my code</strong></p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PICTURE) {
          Uri selectedImageUri = data.getData();
  
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
        }
      }
  }
  </code></pre>
  
  <p><em>Limit size folder not it's the better option.</em></p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>I solved my problem with this method:</p>
  
  <pre><code>public boolean MaxSizeImage(String imagePath) {
      boolean temp = false;
      File file = new File(imagePath);
      long length = file.length();
  
      if (length &lt; 1500000) // 1.5 mb
          temp = true;
  
      return temp;
  }
  </code></pre>
  
  <p>if you need imagePath, you can use this method </p>
  
  <pre><code> public String getImagePath(Uri uri){
       Cursor cursor = getContentResolver().query(uri, null, null, null, null);
       cursor.moveToFirst();
       String document_id = cursor.getString(0);
       document_id = document_id.substring(document_id.lastIndexOf(":")+1);
       cursor.close();
  
       cursor = getContentResolver().query(
               android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
               null, MediaStore.Images.Media._ID + " = ? ", new String[]{document_id}, null);
       cursor.moveToFirst();
       String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
       cursor.close();
  
       return path;
   }
  </code></pre>