【发布时间】:2019-02-09 10:41:31
【问题描述】:
我正在尝试获取从第三方应用(例如 WhatsApp)到我的应用(在 Marshmallow 上进行测试)的视频路径。当我从 WhatsApp 分享视频并将其分享到我的应用程序时,我得到的 URI 是这样的:
content://com.whatsapp.provider.media/item/12
// Get intent, action and MIME type
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
if ("text/plain".equals(type)) {
} else if (type.startsWith("image/")) {
} else if (type.startsWith("video/")) {
Uri videoUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
}
}
如何从上面的 URI 中获取视频文件的路径?
【问题讨论】:
-
我尝试使用此链接,但我无法获得路径,有人可以帮我解决这个问题..stackoverflow.com/questions/51530890/…
标签: android share filepath intentfilter