Note that there are some explanatory texts on larger screens.

plurals
  1. POBeautiful way to come over bug with ACTION_IMAGE_CAPTURE
    primarykey
    data
    text
    <p>I faced problem: ACTION_IMAGE_CAPTURE intent's behaviour depends on hardware manufacturer.</p> <p>I think, best way to get photo from camera inserted in photo gallery must be something like following</p> <pre><code>Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, CAPTURE_IMAGE_REQUEST); </code></pre> <p>and then get uri in <code>onActivityResult</code>:</p> <pre><code>switch (requestCode) { case CAPTURE_IMAGE_REQUEST: { if(resultCode == Activity.RESULT_OK) { Uri uri = intent.getData();// content uri of photo in media gallery //do something with this } break; } </code></pre> <p>But I see, that this doesn't work on many devices; moreover, I found several different scenarios of Camera app behaviour:</p> <ul> <li>some devices have <a href="http://code.google.com/p/android/issues/detail?id=1480" rel="nofollow">bug</a> with this event, so there is no way to get fullsized photos, and you can get 512px wide photo using tmp file in public directory only</li> <li>some devices (including mine) insert taken photo into gallery, but does not return Uri. (getData() returns null, intent extras have only boolean key 'specify-data', value = true) If I try to get photo through the public tempfile then photo will be inserted into both gallery and tempfile.</li> <li>some devices don't insert taken photos to gallery - and I must do it manually</li> <li>I dont know, but there can be other different scenarious</li> </ul> <p>So, is there best practices in managing such problems to cover a wide range of devices and manufacturers?</p> <p>In this case I need take photo from camera, get it inserted into gallery, then get uri of photo in gallery.</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.
 

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