Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, "emailaddress@emailaddress.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "I'm email body.");
startActivity(Intent.createChooser(intent, "Send Email"));
Run Code Online (Sandbox Code Playgroud)
上面的代码打开一个对话框,显示以下应用程序: - 蓝牙,Google Docs,Yahoo Mail,Gmail,Orkut,Skype等.
实际上,我想过滤这些列表选项.我想只显示与电子邮件相关的应用程序,例如Gmail,Yahoo Mail.怎么做?
我在"Android Market"应用程序上看到了这样的例子.
该对话框仅显示电子邮件应用程序,例如Gmail,Yahoo Mail等.它不显示蓝牙,Orkut等.什么代码产生这样的对话?
我正在开发一个Android应用程序,我很想知道如何使用Android的共享意图从应用程序内更新应用程序用户的状态.
通过浏览Facebook的SDK看起来这很容易做到,但是我很想让用户通过常规的Share Intent弹出窗口来完成它吗?看到这里:

我尝试过通常的共享意图代码,但这似乎不适用于Facebook.
public void invokeShare(Activity activity, String quote, String credit) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, activity.getString(R.string.share_subject));
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Example text");
activity.startActivity(Intent.createChooser(shareIntent, activity.getString(R.string.share_title)));
}
Run Code Online (Sandbox Code Playgroud)
更新:进行了更多的挖掘,看起来这是Facebook的应用程序的一个错误尚未解决!(facebook bug)对于平均时间,看起来我只能忍受负面的"分享不起作用!!!" 评论.干杯Facebook:*(
是否有可能显示一个应用程序列表(intent.createChooser仅),只显示我的手机上的我的推特应用程序(所以htc peep(htc hero)或twitdroid).我试过它,intent.settype("application/twitter")但它没有找到任何Twitter的应用程序,只显示我的邮件应用程序.
谢谢,
沃特