ACTION_SEND应用列表很短

时间:2014-02-07 09:17:19

标签: android-intent android

我正在开发Android应用。其中一项功能是通过用户安装的应用程序向朋友发送内容。这是我的代码:

Intent testMessageIntent = new Intent(
                    android.content.Intent.ACTION_SEND);
testMessageIntent.putExtra(Intent.EXTRA_TEXT, "Here is my shared url: "+"http://www.google.com/");
testMessageIntent.setType("plain/text");

startActivity(Intent.createChooser(testMessageIntent, "Share with your friend:"));

这是我在屏幕上看到的内容:

enter image description here

这似乎很不错,但不如我想要的那么好。在Android Jelly应用程序中,他们有一个更长的列表要发送:

enter image description here

这个列表一直在继续,涵盖了我可以发送内容的所有应用程序(WhatsApp,FB,Tumblr,Skype,Twitter等)。

如何在我的应用共享功能中获得此类列表?果冻是否使用了不同的意图?或者他们做了什么特别的事情?

2 个答案:

答案 0 :(得分:2)

我相信您错误地使用plain/text作为参数:

testMessageIntent.setType("plain/text");

您需要的mime类型是text/plain

除了developer pages

  

注意:Android框架中的MIME类型匹配区分大小写,   与正式的RFC MIME类型不同。因此,您应该始终指定   使用小写字母的MIME类型。

答案 1 :(得分:1)

您设置的mimetype不正确。试试这个。

testMessageIntent.setType("text/plain");