Hi Megha,

Thanks for the sample app, but for the next release (1.0) would it be
possible to let the native Camera application respond to an
ACTION_GET_CONTENT intent and return with a media store content uri,
like the Pictures application does now. This way I can use:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(  Intent.createChooser(intent,
getText(R.string.get_picture)) , 1);

To let the user choose if he/she wants to get a picture from the
Camera app or the Pictures app. Currently only the Pictures app works
this way.

I can then simply use the code below to get the resulting picture with
any location information (if available).

protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
  if (resultCode == RESULT_OK)
  {
    if (requestCode == 1)
    {
      Uri uri = data.getData();
      ContentResolver cr = context.getContentResolver();
      Bitmap bitmap =
BitmapFactory.decodeStream( cr.openInputStream(uri) );

      double latitude = 0;
      double longitude = 0;

      Cursor c = cr.query(uri, new String[] {
        MediaStore.Images.ImageColumns.LATITUDE,
        MediaStore.Images.ImageColumns.LONGITUDE
       }, null, null, null);

      if (c != null) {
        c.moveToFirst();
        latitude =
c.getDouble(c.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.LATITUDE));
        longitude =
c.getDouble(c.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.LONGITUDE));
      }

      // Alternatively if the Camera does not use a media store
content uri it could return the latitude and longitude in the extra
fields of the intent.
    }
  }
}

Using the code above, I don't even have to worry about how the Camera
works but I will give the user the option of using the Camera or any
other app that supports GET_CONTENT with image/*.

So I hope you can add support for the GET_CONTENT action in the Camera
app. It should not be that hard because
MediaStore.ACTION_IMAGE_CAPTURE uses a similar approach but does not
return an uri. And the camera app already stores pictures in the media
store on the sdcard.

I think this would also solve a lot of problems people are having in
the developer forum about getting a picture from the camera.

Thanks


On Aug 20, 11:34 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 20, 2008 at 9:40 AM, webmonkey <[EMAIL PROTECTED]> wrote:
>
> > First, a separate question about the Camera app. When I open it it
> > tells me "Press Capture button to take picture". Where is the capture
> > button on the emulator or how do I simulate it?
>
> For the inbuilt Camera app, make sure that you have the sdcard installed.
> Then press the center DPAD key to take a picture.
>
>
>
> > Now the main question. From my app I want to call the native Camera
> > app to get a picture with location information. I am currently using
> > an intent with MediaStore.ACTION_IMAGE_CAPTURE and it does start the
> > Camera app but because of the limitation mentioned above I can't test
> > it. The documentation mentions that "the image is returned as a Bitmap
> > object in the extra field". What is the actual extra field and how
> > would I get any longitude and latitude coordinates?
>
> To use the Camera APIs see the sample app in the post 
> below:http://groups.google.com/group/android-developers/browse_thread/threa...
>
>
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to