简体   繁体   English

如何在列表中获取所有共享应用程序(安装在设备上)?

[英]How to get all share apps (installed on the device) in a list?

i want to get share list and to to be able to share text, i used this question but there were weaknesses such as the Gmail with empty subject filed and the facebook was shown in list but doesn't work with the share. 我想获得共享列表并且能够共享文本,我使用了这个问题,但是存在一些弱点,例如Gmail提交了空主题,而facebook则显示在列表中,但不适用于共享。

i searched for long time but didn't find the complete answer. 我搜索了很长时间但没有找到完整的答案。

please help. 请帮忙。

NOTE: i just want to share text with links nothing more. 注意:我只是想与链接共享文本。

thanx 感谢名单

This is generally handled by using intent.setData(uri) with a URI that has the schema set to a relevant value. 这通常通过使用具有将架构设置为相关值的URI的intent.setData(uri)来处理。 For instance if you wanted to share via email apps you might use the scheme 'mailto' 例如,如果您想通过电子邮件应用程序共享,则可以使用“mailto”方案

Edit: Facebook specific example - The following will work to share with facebook - the bit to note for facebook is it seems like your EXTRA_TEXT needs to be JUST a link or CONTAIN at least one link otherwise Facebook doesn't like it... 编辑:Facebook的具体示例 - 以下将与Facebook分享 - Facebook的注意事项是,你的EXTRA_TEXT似乎只需要一个链接或包含至少一个链接,否则Facebook不喜欢它...

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "This is text from http://www.myapp.com");
startActivity(Intent.createChooser(intent, "Share"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM