Sorry, as the code was directly pasted from my app's code, the line

"startActivityForResult(intent, Editable.IMAGE_CAPTURE_TAG);"

might be confusing - Editable.IMAGE_CAPTURE_TAG doesn't have anything
to do with this excerpt, use any request code instead..

Vytautas

was copy-pasted from my sour

On Dec 10, 7:15 pm, Vytautas Vaitukaitis
<vaitukaitis.vytau...@googlemail.com> wrote:
> I'm using the following code to obtain the 512x384 resolution images
> and it seems to work on all of the devices that I've tested it on (G1,
> Hero, Droid, Tattoo, Magic and some others):
>
>  - to start the camera app
>
> intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
> mImageCaptureUri = Uri.fromFile(new File
> (Environment.getExternalStorageDirectory(), "test" + String.valueOf
> (System.currentTimeMillis()) + ".jpg"));
> intent.putExtra(MediaStore.EXTRA_OUTPUT, imageCaptureUri);
> startActivityForResult(intent, Editable.IMAGE_CAPTURE_TAG);
>
>  - to get the picture, in the onActivityResult() method
>
> Uri source;
> try
> {
>    // this only works with Hero's camera app - otherwise throws
> NullPointerException
>    source = data.getData();}
>
> catch (Exception e)
> {
>    // cannot use this as the only case as Hero's camera app wouldn't
> save the picture where it's asked to, in all of the other phones this
> works, i.e. the picture is saved at the Uri passed with the intent...
>    source = mImageCaptureUri;}
>
> // do whatever you want to do with the image
>
> If there are some issues with this approach, I would be grateful if
> anyone could let me know.
>
> On Dec 9, 3:23 am, API Tests <testapiacco...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'd like to let the user take a picture using the camera, then use it
> > in my app. Ideally I could use the built-in camera app via an intent
> > for this. It looks like there's a range of issues with the camera app
> > though:
>
> >  http://code.google.com/p/android/issues/detail?id=1480
>
> > is the only reliable option to use the 192x256 memory-only image
> > supplied by the camera intent? The following seems to not work:
>
> >  1) Asking the camera intent to write a 'full size' image to disk.
> >  2) Writing your own camera app (issues on different devices etc).
>
> > The Facebook app seems to use the memory-only 192x256 option, probably
> > because that's the only safe option. Anyone else have different
> > opinions / experiences?
>
> > Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to