Skip to content

Instantly share code, notes, and snippets.

@ccjeng
Created December 28, 2015 02:21
Show Gist options
  • Save ccjeng/c091221517ae8b6923ad to your computer and use it in GitHub Desktop.
Save ccjeng/c091221517ae8b6923ad to your computer and use it in GitHub Desktop.
Android Jsoup sample
String html = "<div>
An <a href='http://example.com/'><b>example</b></a> link.</div>
";
Document doc = Jsoup.parse(html);
Element link = doc.select("div > a").text(); //example
Element link = doc.select("div > a").html(); //<b>example</b>
Element link = doc.select("div > a").get(0).text(); //get first link
Element link = doc.select("div").text(); //example link.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment