我正在处理挑选图库图像并在应用程序中显示它们也保存他们的路径以供将来使用 .

我能够从库中选择那些存储在设备上的图像,就像在这个代码中的下载文件夹一样:

Intent intent = new Intent (Intent.ActionPick, Android.Provider.MediaStore.Images.Media.ExternalContentUri);
intent.SetType ("image/*");
StartActivityForResult (Intent.CreateChooser (intent, "Select photo"), 0);

在结果中:

public override void OnActivityResult (int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult (requestCode, resultCode, data);

case 0:
          string FilePath = GetPathToImage (data.Data);
}

private string GetPathToImage(Android.Net.Uri uri)
        {
            string path = null;
            string[] projection = new[] { Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data };
                using (ICursor cursor = this.Activity.ManagedQuery(uri, projection, null, null, null))
                {
                    if (cursor != null)
                    {
                        int columnIndex = cursor.GetColumnIndexOrThrow(Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data);
                        cursor.MoveToFirst();
                        path = cursor.GetString(columnIndex);
                    }
                    else
                    {
                        return uri.Path;
                    }
                }
}

My question is :我能够获取放置在图库中某个本地文件夹中的图像路径,但对于像 Picasa/Autobackup 这样的文件夹,我无法获取路径 .

注意:对于本 Map 像,路径从content:// For Other com.android ....开始 .

那么,是否有任何解决方法来获取这些图像的路径 .

don't 想这样做只显示图像:

final InputStream is = getContentResolver().openInputStream(imageUri);

I need a Path.

如果没有解决方案,那么 How can we skip those images being displayed while Picking 来自图库/照片 .

PS:Known Issue

任何建议表示赞赏 . 谢谢