0

I am using a web view in an android app. I want to replace content_from_whatsapp_url to my a tag MY-MESSAGE. Could you help me please?

HTML:

<a class="btn_whatsapp btn_prop_whatsapp"  href="whatsapp://send?text=MY-MESSAGE" data-action="share/whatsapp/share">Share</a>

Adroid:

whatsappIntent.putExtra(Intent.EXTRA_TEXT, content_from_whatsapp_url);

Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("text/plain");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_TEXT, content_from_whatsapp_url);
startActivity(whatsappIntent);
m02ph3u5
  • 3,022
  • 7
  • 38
  • 51

1 Answers1

0

use JSoup.

Like this Parse HTML:

File input = new File("/tmp/input.html");
Document doc = Jsoup.parse(input, "UTF-8", "http://example.com/");

//http://jsoup.org/cookbook/input/load-document-from-url
//Document doc = Jsoup.connect("http://example.com/").get();

Element content = doc.getElementById("content");
Elements links = content.getElementsByTag("a");
for (Element link : links) {
  String linkHref = link.attr("href");
  String linkText = link.text();
}
Mkurbanov
  • 197
  • 3
  • 13