不能同时共享图片和文字,通过WhatsApp的 [英] Can't share both image and text through whatsapp

查看:1380
本文介绍了不能同时共享图片和文字,通过WhatsApp的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code分享通过whatsapp.But只股票图像,而不是text.I找遍了internet.But图像和文本没得到一个solution..pls帮助。

 字符串消息= FNAME + Mobileno + Homeno + Workmail + Homemail
                + +的Gtalk的Skype +地址+公司+标题+网址;
      意图shareIntent =新意图(Intent.ACTION_SEND);
      URI URI = Uri.parse(文件://
                + Environment.getExternalStorageDirectory()
                +/Talk&Share/Images/profpic.png);      shareIntent.putExtra(Intent.EXTRA_TEXT,消息);
      shareIntent.putExtra(Intent.EXTRA_SUBJECT,联系方式);
      如果(URI!= NULL){
       shareIntent.putExtra(Intent.EXTRA_STREAM,URI);
       shareIntent.setType(图像/平原);
      }其他{
       shareIntent.setType(纯/文);
      }         返回shareIntent;


解决方案

由于现在的WhatsApp支持图片和文字。

 意图shareIntent =新意图();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT,标题+\\ n \\ nLink:+链接);
shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(sharePath));
shareIntent.setType(图像/ *);
startActivity(Intent.createChooser(shareIntent通过分享图片:));

图像会随着它,并通过文本EXTRA_TEXT,它会显示为标题。

I use following code to share an image and text through whatsapp.But it only shares image, not text.I searched all over internet.But didnt get a solution..pls help.

 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; 

解决方案

As of Now Whatsapp Support Image and 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(sharePath));
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share image via:"));

Image will be as it is and pass text as EXTRA_TEXT and it will be shown as caption.

这篇关于不能同时共享图片和文字,通过WhatsApp的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆