Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.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 如何使用共享选项在textview中共享可用内容_Android - Fatal编程技术网

Android 如何使用共享选项在textview中共享可用内容

Android 如何使用共享选项在textview中共享可用内容,android,Android,我开发了一个应用程序。在这个应用程序中,内容来自数据库。我在文本视图中看到的内容,我只想通过电子邮件等方式分享整个内容。。 我如何发送,即共享我的可用内容。 我获得了所有共享选项,但无法共享屏幕上的内容。 请让我知道如果你想要更多的信息 请帮帮我 提前谢谢 这很简单。你只需要说出你的意图 Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[

我开发了一个应用程序。在这个应用程序中,内容来自数据库。我在文本视图中看到的内容,我只想通过电子邮件等方式分享整个内容。。 我如何发送,即共享我的可用内容。 我获得了所有共享选项,但无法共享屏幕上的内容。
请让我知道如果你想要更多的信息
请帮帮我

提前谢谢

这很简单。你只需要说出你的意图

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"yourEmail@gmail.com"});  
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Email Subject");
emailIntent.putExtra(Intent.EXTRA_STREAM,yourTextView.getText());
emailIntent.setType("text/html");
startActivity(emailIntent);

首先,你应该获得你想要分享的文本。其次,您可以使用意图向用户显示共享内容的不同方式。您可以使用以下代码来实现它:

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, textFromTextView);
shareIntent.setType("text/plain");
startActivity(Intent.createChooser(shareIntent,
        "Share with..."));

我认为AndroidWarrior的回答只允许您使用电子邮件,但它是正确的。

我已经这样做了,但仍然无法发送。。这个选项把我带到我想分享的地方,但突然它回来了,没有粘贴内容或分享内容。此外,我只能在gmail上分享内容,但不能在message和whatsapp等上分享内容。。