是否可以从图像意图中获取文件扩展名或mime类型?
下面的代码输出:
文件 路径:content://com.android.providers.media.documents/document/image%3A78
private void StartImagePicker()
{
var imageIntent = new Intent();
imageIntent.SetType("image/*");
imageIntent.SetAction(Intent.ActionGetContent);
StartActivityForResult(
Intent.CreateChooser(imageIntent, "Select photo"), 0);
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == Result.Ok && requestCode == 0)
{
print("File Path:" + data.DataString);
}
}