Mime type for .txt files?

梦想与她 提交于 2019-12-03 14:17:53

问题


I´m trying to share a .txt file with share intent. If I set "text/plain" as mime type, it reads the content like text not like text file, then the options given in the share menu are Whatsapp, Line, etc..

Does anybody know how to configure the share intent so that the share options are only the programs that are able to send a .txt file (Gmail, Dropbox, etc.. but not Whatsapp..)? Thanks


回答1:


You can try the specific mime:

text/plain

or, the more general text mime:

text/*



回答2:


simple and complete example code (less than 50 lines) for app that android will present to the user along with menu list of compatible apps (polaris, browser, etc) when opening a TXT file.

disclaimer: in case user hasnt previously determined a default app

note; TXT may be changed, you can customize your extensions, if you generate the files that your app consumes.



来源:https://stackoverflow.com/questions/14492138/mime-type-for-txt-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!