Android uses jsup to grab page data
Jsoup is a Java HTML parser, which can directly parse a URL address and HTML text content. It provides a very labor-saving API, which can fetch and manipulate data through DOM, CSS and operation methods similar to jQuery.
Official Chinese address of jsup: http://www.open-open.com/jsoup/parse-document-from-string.htm You can find some instructions on this website Download of jar file, description of doc document, etc
The main functions of jsoup are as follows:
Jsoup is released based on MIT protocol and can be safely used in commercial projects.
The methods under the jsup class are static and can be called directly. Description of several methods
The Connect () method gets a Connection, and then calls the Connection object get () method to get the Document object. Then parse the document object. Connection provides some setting methods, such as timeout (), URL (), and so on
Here is the test code of Java project I use
Let's introduce how to use jsup to asynchronously parse web page data in Android. Please note: it's easy to encounter a problem of garbled code here
Configuration file: androidmanifest Adding permissions to XML
Layout file for layout
Code for loading data asynchronously
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.