Parsing HTML in Android with Jsoup
    Â
JSoup is a Java library that helps android developer melbourne to extract and manipulate HTML file. Using this library, developer can parse html page in Android. You will learn how to use JSoup to start parsing HTML in Android, we will talk about how to setup an Android project that uses JSoup and how to extract some information.
Setup the project and integrate JSoup
The first step is creating a standard Android project that contains a simple Activity; let's assume you are using Android Studio to do it. Once your project is ready, you will have to add the JSoup dependency. So open build gradle file and in the dependency section add the Jsoup.jar file in the libs folder of your android project.
Example:
compile 'org.jsoup:jsoup:1.7.3'
Then, right click on the jar file and click on add as library in the fly-out menu that pop-up in your Android Studio. After that, you are to use JSoup API and continue with the design of your main layout file. Every android developer should not find it difficult creating this android app development.
Creating the App: Parse html page
Once you know the basic information about JSoup API, you can start coding your app. The first thing to have in mind is that you are calling a remote website, so you can’t use your JSoup API in the main thread otherwise you could have ANR problems.
Activity_main.xml
Open the activity_main.xml file, drag and drop 2 View controls.
1. TextView which will be used to display the title data of the parsed HTML file.
2. Button View – when a user click on this View it will display the title information of HTML file or page.
Then add some string literals in the string.xml file which will be use in your main layout. Save the file and run your project.