@Mark

What actually happens with Hero (though, I'm not 100% sure it is the
case, but it would be quite easy to check) is that it saves the image
to the default location for the images even if you add the
EXTRA_OUTPUT field to the intent.. Note that data.getData() returns
the Uri, which is of the form content://... and links to the actual
image, which you then have to retrieve and copy to the location you
wanted it to be at the first place. It doesn't contain the actual
data.

Also, when I said that it seems to be working on the phones that I've
tested it on, I meant, this code is enough to retrieve the images - I
haven't checked if the resolution is actually 512x384, though I would
have probably noticed if it was less than that.

@Matt

Yes, you're absolutely right - I'm trying to do what works on Hero -
if that fails, I do what works on all the other phones.

I'm not quite sure about which of the Camera API issues you're talking
about: the failure to retrieve images with resolution greater than
512x384 or lack of single method to obtain images of 512x384
resolution?

On 11 Gruo, 02:20, Mark Wyszomierski <[email protected]> wrote:
> @Vytautas
>
> If I'm reading your sample right, would data.getData() even return
> anything at all for the Hero when requesting the disk image? Because
> if you're putting "EXTRA_OUTPUT" in the intent, I thought it wouldn't
> return the memory bitmap *at all* ? Looks like you're trying this:
>
> // Camera intent using "EXTRA_OUTPUT"
> // onActivityResults
> Bitmap bmp;
> try {
>    // Here won't save larger bmp to disk due to bug or wrong
> implementation, but you think it will return mem bmp instead.
>    bmp = data.getData();}
>
> catch (NullPointerException ex) {
>   // The other phones will return NULL for data.getData(), so here we
> should get the image from disk saved correctly.
>   bmp = loadFromSpecifiedPath(...);
>
> }
>
> is that what you did? I just tried out a few phones to see what size
> bmps they return for the mem vs disk bitmaps. I found the Eris also
> *does NOT* save the disk image properly, like the Hero:
>
> Droid
> mem: 121 x 162
> disk: 2592 x 1936
>
> Eris:
> mem: 208 x 312
> disk: did not work!
>
> Hero:
> All phones I've tried crash with both methods, also the native camera
> app crashes.
>
> Samsung Moment:
> 256 x 192
> 512 x 384
>
> myTouch:
> 256 x 192
> 384 x 512
>
> G1
> 192 x 256
> 384 x 512
>
> if anyone else can share their stats that'd be really helpful,
>
> Thanks
>
> On Dec 10, 8:46 pm, Matt Kanninen <[email protected]> wrote:
>
>
>
> > Ohhhhhh this is a lot uglier then I thought:
>
> >http://code.google.com/p/android/issues/detail?id=1480
>
> > I think we need a google blog post on how to do this and support 1.5,
> > 1.6 and 2.0 handsets.
>
> > On Dec 10, 5:38 pm, Matt Kanninen <[email protected]> wrote:
>
> > > Ok I'm at the point where I'm trying to read back the image returned
> > > from the camera, I didn't notice till now the Hero is special.  So
> > > you're just doing what works for the Hero, catching the null pointer,
> > > then doing what works for the rest?
>
> > > I'm betting this is an Android 1.5 issue?  Most of the other phones
> > > are 1.6 now.  The Hero is odd for other reasons too though.
>
> > > On Dec 10, 11:15 am, Vytautas Vaitukaitis
>
> > > <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to