Answer the question
In order to leave comments, you need to log in
Parsing html in android. There are examples?
Hello. I want to make an application that will display a list of elements, where each element is a "template layout". The data for each element is taken from the html page (By elements. One element on the site - one list element in android).
It seems nothing complicated, for this they use recyclerview + jsoup + picasso.
Probably badly searched, but basically it's "take the title from the site and display it in a TextView".
Are there any comprehensive tutorials that explain my scenario? (Perhaps there are better libraries than the ones I wrote?
Thanks in advance)
Answer the question
In order to leave comments, you need to log in
Look aside: https://jsoup.org/
You can see the examples themselves: https://jsoup.org/cookbook/
For a similar task, I once used HtmlUnit . But it is in fact a full-fledged web browser. Perhaps in your case it will be "from a cannon to sparrows." Nevertheless, the functionality you need is present in this library: see Finding a specific element
UPD. If the html site is yours, do not be lazy to write scripts that provide information for the application in something more suitable than HTML. HTML is a markup language. Get on the bright side, use JSON, CSV, or, at worst, XML. By using HTML for these purposes, you force more resources to process your data and bring the heat death of the universe closer. And if no jokes - why force a person to pull data through the mobile Internet that is not useful? Just eat traffic. And think of the people who might be using the app in places far from even 3G stable coverage.
In most cases, the built-in android tools based on TagSoup are sufficient.
For difficult situations, there is Jsoup. In addition, you can parse HTML into Android native views, such as the HTMLNative library .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question