Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems saving a photo to a file
    primarykey
    data
    text
    <p>Man, I am <em>still</em> not able to save a picture when I send an intent asking for a photo to be taken. Here's what I am doing:</p> <ol> <li><p>Make a URI representing the pathname</p> <pre><code>android.content.Context c = getApplicationContext(); String fname = c.getFilesDir().getAbsolutePath()+"/parked.jpg"; java.io.File file = new java.io.File( fname ); Uri fileUri = Uri.fromFile(file); </code></pre></li> <li><p>Create the Intent (don't forget the pkg name!) and start the activity</p> <pre><code>private static int TAKE_PICTURE = 22; Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); intent.putExtra("com.droidstogo.boom1." + MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult( intent, TAKE_PICTURE ); </code></pre></li> <li><p>The camera activity starts, and I can take a picture, and approve it. My <code>onActivityResult()</code> then gets called. But my file doesn't get written. The URI is: file:///data/data/com.droidstogo.boom1/files/parked.jpg</p></li> <li><p>I can create thumbnail OK (by not putting the extra into the Intent), and can write that file OK, and later read it back).</p></li> </ol> <p>Can anyone see what simple mistake I am making? Nothing obvious shows up in the logcat - the camera is clearly taking the picture. Thanks,</p> <p>Peter</p> <hr> <p>I should mention that I have the appropriate permissions set in the AndroidManifest.xml file:</p> <pre><code> &lt;uses-permission android:name="android.permission.READ_OWNER_DATA" /&gt; &lt;uses-permission android:name="android.permission.WRITE_OWNER_DATA" /&gt; &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-feature android:name="android.hardware.camera" /&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;/application&gt; </code></pre> <p>Any ideas? Any ideas on things to try, to get more info about the problem?</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.
 

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