xamarin android 文件选择
调出选择界面:
Intent intent = new Intent(Intent.ActionGetContent); intent.AddCategory(Intent.CategoryOpenable); intent.SetType("file/*"); StartActivityForResult(Intent.CreateChooser(intent, "选择备份文件"), 20);
接收选择结果:
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { if (requestCode == 20) { var uri = data.Data as Android.Net.Uri; var filepath = uri.Path; } base.OnActivityResult(requestCode, resultCode, data); }
桂棹兮兰桨,击空明兮溯流光。