通过WhatsApp共享图像和文本 [英] Share image and text through whatsapp
本文介绍了通过WhatsApp共享图像和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码通过WhatsApp共享图像和文本.但是,它仅共享图像,而不共享文本.我在整个Internet上进行了搜索,但没有找到解决方法.
I use the following code to share an image and text through WhatsApp. It only shares the image, not the text, however. I have searched all over the Internet, but haven't found a solution.
String message = Fname + Mobileno + Homeno + Workmail + Homemail
+ Gtalk + Skype + Address + Company + Title + Website;
Intent shareIntent = new Intent(Intent.ACTION_SEND);
Uri uri = Uri.parse("file://"
+ Environment.getExternalStorageDirectory()
+ "/Talk&Share/Images/profpic.png");
shareIntent.putExtra(Intent.EXTRA_TEXT, message);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Contact");
if(uri != null){
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/plain");
}else{
shareIntent.setType("plain/text");
}
return shareIntent;
推荐答案
Whatsapp支持图像与文本共享.
Whatsapp Support Image sharing along with text.
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT,title + "\n\nLink : " + link );
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imageFilePath));
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share image via:"));
这将共享图像,而EXTRA_TEXT将被视为图像标题.
This will share image and EXTRA_TEXT will consider as image caption.
这篇关于通过WhatsApp共享图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文