Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.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
分享图片缩略图和标题文本,如Instagram分享给WhatsApp Android_Android_Android Intent_Whatsapp_Android Sharing - Fatal编程技术网

分享图片缩略图和标题文本,如Instagram分享给WhatsApp Android

分享图片缩略图和标题文本,如Instagram分享给WhatsApp Android,android,android-intent,whatsapp,android-sharing,Android,Android Intent,Whatsapp,Android Sharing,我需要像Instagram在所附图片中一样将内容分享给whatsapp 标题部分有图像、标题文本和链接的缩略图。 然后,消息部分有一个链接 消息部分是直截了当的。关于实现标题部分的任何帮助都会有所帮助 Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TITLE, "title text"); sendInten

我需要像Instagram在所附图片中一样将内容分享给whatsapp

标题部分有图像、标题文本和链接的缩略图。 然后,消息部分有一个链接

消息部分是直截了当的。关于实现标题部分的任何帮助都会有所帮助

Intent sendIntent = new Intent();   
sendIntent.setAction(Intent.ACTION_SEND);   
sendIntent.putExtra(Intent.EXTRA_TITLE, "title text");   
sendIntent.putExtra(Intent.EXTRA_TEXT, "message section");   
sendIntent.setType("text/plain"); 
startActivity(sendIntent);
我已经阅读了whatsapp常见问题解答,但他们没有提到从意图处理的标签列表

尝试下面的代码

Uri imgUri = Uri.parse(pictureFile.getAbsolutePath());
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.setPackage("com.whatsapp");
    intent.putExtra(Intent.EXTRA_TEXT, "The text you wanted to share");
    intent.putExtra(Intent.EXTRA_STREAM, imgUri);
    intent.setType("image/jpeg");
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

    try {
        activity.startActivity(intent);
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.MakeText(this,"Whatsapp not found",Toast.LENGTH_SHORT).show();
    }

@谢谢你的回复。我不想创建像上图那样的视图。我需要的是知道意图应该如何构造,以便WhatsApp创建一个类似tat的消息。您是否检查过这个:@Nilesh Rathod。抱歉,找不到与相关的答案this@Nilesh拉托德。上面提到的stackoverflow链接给出了完整的答案。谢谢无法投票,因为我无意中取消了投票。