检索从其他应用程序的内容文件名 [英] Retrieve file name of content from other apps

查看:137
本文介绍了检索从其他应用程序的内容文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经注册我的应用程序收到以下的这个帖子

我已经实现了这是回答了解决方案,但我不能找到一种方法来获取数据流的文件名。
作为从开放的一个例子,如:


  

内容://下载/ all_downloads / 5


我可以流出来,但我不知道有关原始文件生成它的名字东西。

有没有办法找回它?


解决方案

  

有没有办法找回它?


一般来说,没有,因为有可能不是一个名称,部分是因为可能不存在的文件。您可以得到一个的InputStream 上的内容,但是,这并不意味着有背后的的InputStream 。

有可能对某些特定的供应商(例如, MediaStore )来尝试确定一些数据关联的文件名乌里一些特定的黑客,尽管这种黑客可能不可靠。

I have registered my app to receive files (of any type, not just images) from other apps following this post.

I have implemented the solution that was answered but I cannot find a way to retrieve the "file name" of the data stream. As an example from an Uri like:

content://downloads/all_downloads/5

I can get the stream out but I don't know anything about the name of the original file generating it.

Is there a way to retrieve it?

解决方案

Is there a way to retrieve it?

Generally, no, because there may not be a name, in part because there may not be a file. You may be able to get an InputStream on the contents, but that does not mean that there is a file behind the InputStream.

There may be some specific hacks for some specific providers (e.g., MediaStore) to try to determine the file name associated with some data Uri, though such hacks may not be reliable.

这篇关于检索从其他应用程序的内容文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆