Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 聊天应用程序的意图_Android - Fatal编程技术网

Android 聊天应用程序的意图

Android 聊天应用程序的意图,android,Android,我想从我的应用程序发送文本,已使用剪贴板管理器将文本复制到剪贴板。现在我想做的是创建一个意向选择器,它只显示聊天应用程序,如Hike、WhatsApp、sms或任何其他类似的应用程序 怎么做?只需使用发送意图即可 类似于: String shareBody = "Here is the share content body"; Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingInt

我想从我的应用程序发送文本,已使用剪贴板管理器将文本复制到剪贴板。现在我想做的是创建一个意向选择器,它只显示聊天应用程序,如Hike、WhatsApp、sms或任何其他类似的应用程序


怎么做?

只需使用发送意图即可

类似于:

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等将忽略该主题,而彩信或电子邮件将使用它。

非常感谢。成功了:)。我也试着这么做。但是我想我犯了一些错误。。你的代码工作正常。。。谢谢你。成功了:)。我也试着这么做。但是我想我犯了一些错误。。你的代码工作正常。。。塔克斯