调出选择界面:
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); }
原文地址:https://www.cnblogs.com/nanfei/p/9194685.html
时间: 2024-11-08 23:46:06