Does your code work?
I have exactly the same source and i'm setting the cursor to the first
element.

The only problem is that my latitutde-value is always 0. But the image
has EXIF information about the location in it.

Can somebody help me?

Regards Georg

On Apr 1, 8:11 pm, Bobbie <[email protected]> wrote:
> I am launching an image picker (from the gallery) and my code crashes
> every single time.  I tried to get some help in another post, but
> people quit responding to the post.  Please help.  When I do a debug,
> it tells me this (there are TONS of errors, but these looked the most
> important - also, I changed the "com.app.name/com.app.name.activity"
> for privacy reasons):
>
> 04-01 14:09:30.254: WARN/dalvikvm(719): threadid=3: thread exiting
> with uncaught exception (group=0x4000fe68)
> 04-01 14:09:30.254: ERROR/AndroidRuntime(719): Uncaught handler:
> thread main exiting due to uncaught exception
> 04-01 14:09:30.274: ERROR/AndroidRuntime(719):
> java.lang.RuntimeException: Failure delivering result ResultInfo
> {who=null, request=1, result=-1, data=Intent { data=content://media/
> external/images/media/7 }} to activity {com.app.name/
> com.app.name.activity}:
> android.database.CursorIndexOutOfBoundsException: Index -1 requested,
> with a size of 1
> 04-01 14:09:30.274: ERROR/AndroidRuntime(719): Caused by:
> android.database.CursorIndexOutOfBoundsException: Index -1 requested,
> with a size of 1
>
> Here is the code that invokes the activity, follwed by the code that
> is invoked after the activity has finished:
>
> public void takePic() {
>                 Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
>                 photoPickerIntent.setType("image/*");
>                 startActivityForResult(photoPickerIntent, 1);
>
> }
>
> @Override
> protected void onActivityResult(int i, int j, Intent intent)
> {
>     super.onActivityResult(i, j, intent);
>
>     Uri photoUri = intent.getData();
>
>     ContentResolver cr = getContentResolver();
>     Cursor cursor = cr.query(photoUri, new String[] {
>             MediaStore.Images.ImageColumns.LATITUDE,
>             MediaStore.Images.ImageColumns.LONGITUDE
>      }, null, null, null);
>
>     long fname = cursor.getLong(cursor.getColumnIndexOrThrow
> (MediaStore.Images.ImageColumns.LATITUDE));
>
>     chatscreen.append("File Name: "+fname);
>
> }

--~--~---------~--~----~------------~-------~--~----~
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