Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have faced the exact same problem,<br> Finally the solution I found, was to launch an ACTION_GET_CONTENT intent instead of an ACTION_PICK, then make sure you provide a MediaStore.EXTRA_OUTPUT extra with an uri to a temporary file. Here is the code to start the intent : </p> <pre><code>public class YourActivity extends Activity { File mTempFile; int REQUEST_CODE_CHOOSE_PICTURE = 1; (...) public showImagePicker() { mTempFile = getFileStreamPath("yourTempFile"); mTempFile.getParentFile().mkdirs(); Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mTempFile)); intent.putExtra("outputFormat",Bitmap.CompressFormat.PNG.name()); startActivityForResult(intent,REQUEST_CODE_CHOOSE_PICTURE); } (...) } </code></pre> <p>You might need to mTempFile.createFile() </p> <p>Then in onActivityResult, you will be able to get the image this way </p> <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { case REQUEST_CODE_CHOOSE_PICTURE: Uri imageUri = data.getData(); if (imageUri == null || imageUri.toString().length() == 0) { imageUri = Uri.fromFile(mTempFile); file = mTempFile; } if (file == null) { //use your current method here, for compatibility as some other picture chooser might not handle extra_output } } </code></pre> <p>Hope this helps</p> <p>Then you should delete your temporary file on finish (it is in internal storage as is, but you can use external storage, I guess it would be better). </p>
    singulars
    1. This table or related slice is empty.
    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