You are right, I know these things, but thats not the problem.

The problem is that i always get 0.0 for the Latitude and Longitude
column.
That's the problem.
Any ideas?

Regards Georg

On Apr 27, 7:05 pm, Sergey Ten <[email protected]> wrote:
> After query returns the cursor, it has to be moved forward. It can be done
> as follows:
>
>    ContentResolver cr = getContentResolver();
>    Cursor cursor = cr.query(photoUri, new String[] {
>            MediaStore.Images.
>
>
>
> > ImageColumns.LATITUDE,
> >            MediaStore.Images.ImageColumns.LONGITUDE
> >     }, null, null, null);
>
> if (cursor != null && cursor.getCount() > 0) {
>     cursor.moveToFirst();
>     long fname = cursor.getLong(cursor.
>
>
>
> >               getColumnIndexOrThrow
> >               (MediaStore.Images.ImageColumns.LATITUDE));
>
> > chatscreen.append("File Name: "+fname);
> }
>
> Sergey
>
> On Wed, Apr 1, 2009 at 11:11 AM, 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