如何将HTML文本共享到whatsapp意图 [英] How to share Html text to whatsapp intent
本文介绍了如何将HTML文本共享到whatsapp意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过whatsapp intent
共享Html
文本.我写的代码如下.
I want to share Html
text via whatsapp intent
. The code I have written is below.
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/html");
sharingIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder()
.append("<p><b>Some Content</b></p>")
.append("<small><p>More content</p></small>")
.toString()));
this.getContext().startActivity(Intent.createChooser(sharingIntent,"Share using"));
但是whatsapp应用程序未显示在Intent选择器列表中.
有人可以建议我解决方案吗?
Can anyone suggest me the solution?
推荐答案
尝试一下
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setPackage(com.whatsapp);
sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder()
.append("<p><b>Some Content</b></p>")
.append("<small><p>More content</p></small>")
.toString()));
sendIntent.setType("text/html");
context.startActivity(sendIntent);
这篇关于如何将HTML文本共享到whatsapp意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文