How can I get the path from any file that I get from local or external storage on android? Here is my code:
Intent = new Intent(Intent.ActionOpenDocument);
string[] mimetypes =
{
"application/pdf", "image/png", "image/jpeg", "image/tiff", "application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
};
Intent.PutExtra(Intent.ExtraMimeTypes, mimetypes);
Intent.SetType("*/*");
Intent.SetAction(Intent.ActionGetContent);
Intent.AddCategory(Intent.CategoryOpenable);
StartActivityForResult(Intent.CreateChooser(Intent, "Select file"), Constant.PickPDFId);
And the OnActivityResults I got:
base.OnActivityResult(requestCode, resultCode, data);
if (requestCode == Constant.PickPDFId && resultCode == Result.Ok && data != null)
{
var FilePath= data.Data.Path;
}
The FilePath has a colon in between 'document/3137-3837:Screenshots/Screenshot_2018.png . How can I get the valid path without the colon?