Android 聊天应用程序的意图
我想从我的应用程序发送文本,已使用剪贴板管理器将文本复制到剪贴板。现在我想做的是创建一个意向选择器,它只显示聊天应用程序,如Hike、WhatsApp、sms或任何其他类似的应用程序Android 聊天应用程序的意图,android,Android,我想从我的应用程序发送文本,已使用剪贴板管理器将文本复制到剪贴板。现在我想做的是创建一个意向选择器,它只显示聊天应用程序,如Hike、WhatsApp、sms或任何其他类似的应用程序 怎么做?只需使用发送意图即可 类似于: String shareBody = "Here is the share content body"; Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingInt
怎么做?只需使用发送意图即可 类似于:
String shareBody = "Here is the share content body";
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "body text");
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using)));
它将显示所有应用程序,包括电子邮件。WhatsApp等会忽略主题,而彩信或电子邮件会使用它。只需使用发送意图即可 类似于:
String shareBody = "Here is the share content body";
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "body text");
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using)));
它将显示所有应用程序,包括电子邮件。WhatsApp等将忽略该主题,而彩信或电子邮件将使用它。非常感谢。成功了:)。我也试着这么做。但是我想我犯了一些错误。。你的代码工作正常。。。谢谢你。成功了:)。我也试着这么做。但是我想我犯了一些错误。。你的代码工作正常。。。塔克斯