简体   繁体   中英

How do i get relevant Information from a Webpage (HTML) into my Android App?

at first i have to say that my english isnt the best so dont blame me for that:).

I want to create a Food-App for Android-Systems which is able to get Information (like ingredients,preperation) of Webpages by downloading them through an Asynctask and saving them into a Database (SQLite).

I learned to work with JSON - based website and to show the results(after downloading the data) in a ListView. Now i have the problem that i dont have JSON in front of me and i have really no clue about how i can write a code which extracts relevant information of HTML - Webpage. Is it even possible?

Sorry if maybe of u may laugh now how unknowing i am but i try to learn:)

So i basically know much about Asynctask and Databases. But the point is i dont know how to connect them all with my specific problem.

Thank you in advance for all who will deal with my topic!

Try working with jsoup . Here you can find the jsoup library and full source code.

See an example at this site: http://www.vogella.com/tutorials/jsoup/article.html


Add jsoup to your project by adding this line to your app build.gradle :

compile 'org.jsoup:jsoup:1.10.3'

HTML is a XML based presentation of pages.

You can parse it with DOM, if theres repeated tags you may find easier to parse with SAX. But you will need to parse every information on the site and navigate trough the graph to extract what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM