如何在Android上将视频从其他应用共享到我的应用

时间:2018-08-13 09:29:24

标签: android video share

我以前是文件提供者,将视频从另一个应用程序共享到我的应用程序。.我具有uri值,但是我无法从uri中获取文件名

if (receivedAction != null) {
    if (receivedAction.equals(Intent.ACTION_SEND)) {
        //content is being shared
        if (receivedType.startsWith("text/")) {
            //handle sent text
        } else if (receivedType.startsWith("video/")) {
            //handle sent image
            Uri receivedUri = (Uri) receivedIntent.getParcelableExtra(Intent.EXTRA_STREAM);

            if (receivedUri != null) {

                String datas = null;
                try {
                    uri = getFilePath(this, receivedUri);
                } catch (URISyntaxException) {
                    e.printStackTrace();
                }
            }
        }
    }
}

0 个答案:

没有答案