I'm trying to get the path of a any kind of file but in don't know why it only works with images, with any other file extension path is always null. Here's my code:
private string GetPath(Android.Net.Uri uri)
{
string path;
string[] projection = new[] { Android.Provider.MediaStore.MediaColumns.Data };
using (ICursor cursor = ManagedQuery(uri, projection, null, null, null))
{
if (cursor != null)
{
int columnIndex = cursor.GetColumnIndexOrThrow(Android.Provider.MediaStore.MediaColumns.Data);
cursor.MoveToFirst();
path = cursor.GetString(columnIndex);
}
}
return path;
}
Am I doing something wrong or is there any other way to do it?
Thank you!