Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you considered just using a library like this one:</p> <p><a href="https://github.com/biokys/cropimage" rel="nofollow">https://github.com/biokys/cropimage</a></p> <p>I find the com.android.camera.action.CROP can sometimes behave differently from phone to phone and is not always available, so it could cause some problems for you anyway if you are looking to release it.</p> <p><strong>UPDATE:</strong></p> <p>I have tested the above library with Android 4.3 and it works with no problem. You just need to add the library to your project.</p> <p>You can then write your method in a very similar way:</p> <pre><code>private void performCrop(Uri picUri) { //you have to convert picUri to string and remove the "file://" to work as a path for this library String path = picUri.toString().replaceAll("file://", ""); try { int aspectX = 750; int aspectY = 1011; Intent intent = new Intent(this, CropImage.class); //send the path to CropImage intent to get the photo you have just taken or selected from gallery intent.putExtra(CropImage.IMAGE_PATH, path); intent.putExtra(CropImage.SCALE, true); intent.putExtra("aspectX", aspectX); intent.putExtra("aspectY", aspectY); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(mCurrentPhotoPath))); startActivityForResult(intent, CROP); } catch (ActivityNotFoundException anfe) { String errorMessage = "Your device doesn't support the crop action!"; Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); toast.show(); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload