Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Filename when using a filepicker

$
0
0

Hi I can't find a working solution on how to get the filename when I try to implement a filepicker, the uri works and I can load the file and so on but have no clue on how to parse out the actual name of the file?

My code:

    void ButtonOnClick(object sender, EventArgs eventArg)
    {
        Intent = new Intent();
        Intent.SetAction(Intent.ActionGetContent);
        Intent.SetType("audio/mpeg");
        StartActivityForResult(Intent.CreateChooser(Intent, "Select Soundfile"), PickId);

    }
    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        if ((requestCode == PickId) && (resultCode == Result.Ok) && (data != null))
        {
            Uri uri = data.Data;
            //var filename = data.???
            System.Diagnostics.Debug.WriteLine("---Uri:"+uri);
            System.Diagnostics.Debug.WriteLine("---Filename:");// + filename);
        }
    }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>