1

I am using following code to convert the Android.Net.Uri path to physical path:

       private string GetPathToImage (Android.Net.Uri uri)
    {
        string path = null;
        // The projection contains the columns we want to return in our query.
        string[] projection = new[] { Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data };

        using (ICursor cursor = ManagedQuery (uri, projection, null, null, null)) {
            if (cursor != null) {
                int columnIndex = cursor.GetColumnIndexOrThrow (Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data);
                cursor.MoveToFirst ();
                path = cursor.GetString (columnIndex);

            }
        }
        return path;
    }

But its not working. I am getting null value in "path". The Android.Net.Uri path is as follows:

//com.android.providers.media.documents/document/image%3A43306

And I want the physcial path like:

files/Pictures/temp/IMG_20151201_194231.jpg

How I can achieve this?

Regards, Anand Dubey

anand
  • 1,399
  • 5
  • 23
  • 55

0 Answers0