Hi,

The problem is that it should be documented in the Android Reference,
here:

http://developer.android.com/reference/android/provider/MediaStore.Images.html
http://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns.html

But, as far as i understand, it's not complete. Fortunately, we can
check it in a different way.

<android code>
                Uri u = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; //sdcard 
only
                Cursor c = managedQuery(u, null, null, null, null);

                if (c.moveToFirst()) {
                        do {
                                int max = c.getColumnCount();
                                for (int i = 0; i < max; i++) {
                                        String colName = c.getColumnName(i);
                                        String value = c
                                                        
.getString(c.getColumnIndex(colName));

                                        if (colName != null){
                                                Log.d("columnName: ", colName);
                                        }

                                        if (value != null) {
                                                Log.d("value", value);
                                        }
                                }
                        } while (c.moveToNext());
                }
</android code>

Check LogCat and you'll notice that we have all column names with
their values. I suppose, you'd be interested in:

07-22 12:50:09.973: DEBUG/columnName:(3049): _data
07-22 12:50:09.973: DEBUG/value(3049): /sdcard/download/vienna-s-
schonbrunn-zoo-and-giant-ferris-wheel-in-vienna-1.jpg
(...)
07-22 12:50:09.983: DEBUG/columnName:(3049): _display_name
07-22 12:50:09.983: DEBUG/value(3049): vienna-s-schonbrunn-zoo-and-
giant-ferris-wheel-in-vienna-1.jpg

If you have got any questions, don't hesitate to ask.

Greetings!

On Jul 22, 10:28 am, Mina Shokry <[email protected]> wrote:
> Hello,
>
> I am using content provider to access images in phone gallery and
> everything works fine except one thing that I want to get the physical
> file name of images I access. Can I get a java.io.File object from
> android.net.Uri object?
> if no, is there any other way to accomplish such a task?
> I just need to know the file name!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to