Android 自定义文件扩展名
我希望我的 Android 应用程序能够通过蓝牙、电子邮件、wifi direct 等(标准共享方法)共享文件。我想将我的数据解析为具有自定义扩展名的文件,并通过某种共享方法(例如蓝牙)发送它。收件人应该能够打开该文件,然后我的应用程序启动并处理该文件。在互联网上搜索了一下,结果很短,有人知道有这方面教程的好网站吗?或者也许有关于这个主题的阅读材料?
I want my android app to be able to share files through bluetooth, e-mail, wifi direct etc... (the standard sharing methods). I want to parse my data into a file with a custom extension and send it through some sharing method say bluetooth. The recipient should be able to open the file then my app starts and handles the file. Searched around the internet and came up short, does anyone know any good sites with tutorials on this? Or perhaps any reading materials on this topic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哈!最初,我似乎在这次搜索中一无所获,但我的坚持终于实现了。
Android 意图过滤器:将应用程序与文件扩展名关联起来
那么,什么他们在这里所做的是在manifest.xml 文件中设置一个
intent-filter
,这将使您的应用能够打开这些类型的文件。在您的情况下,我怀疑您的代码看起来像这样,我认为文件浏览器将能够从意图代码的该部分获取要显示的图标。但我对此了解不多,所以不要引用我的话 :p
编辑:此意图过滤器应该位于将处理自定义文件的活动/服务/接收器内部用户正在打开。
Ha! I also initially seemed to come up dry on this search, but my persistence finally pulled through.
Android intent filter: associate app with file extension
So, what they did on here is set up a
intent-filter
in the manifest.xml file that will enable your app to open those kinds of files. In your case, I would suspect that your code would look something like thisI presume that the file browsers will be able to get the icon to display from that part of the intent code. But I don't know too much about that, so don't quote me on it :p
Edit: This intent filter should go inside the activity/service/receiver that is going to process the custom file the user is opening.