【发布时间】:2013-05-08 12:02:09
【问题描述】:
我想绕过 Intent.ACTION_PICK 这样做我需要插入内容 uri,但我有带 url 的字符串。
我需要转换这种格式:
/mnt/sdcard/Movies/Your_voice/Your_voice080513_141510.mp4
转 uri 格式:
content://media/external/video/media/2308
我发现了这个:
How to convert a file:// uri into content:// uri?
还有这个图像 Convert file uri to content uri
更新:
我有一个发送文件的方法,这个方法获取内容 uri。
所以要使用这种方法,我正在使用意图,因为输出是内容 uri。
我正在使用这个意图:
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("video/*");
startActivityForResult(intent, RESULT_PICK_IMAGE_CROP);
此意图打开文件夹,用户选择文件夹和之后的视频文件
我之前的问题: intent ACTION_PICK in specific folder
问题是我只需要特定的文件夹,但我这里是红色的
Using Intent.ACTION_PICK for specific path
这是不可能的。
所以我尝试将我必须的路径转换为内容 url
【问题讨论】:
-
你可以使用 [ Uri.parse(fileName)](developer.android.com/reference/android/net/…)