Taras Stavnychyi
Taras Stavnychyi

Reputation: 975

How to read spesific content from internet page with Android

is that possible in Android to go though whatever link and get main content from that page(f.e.text) or whatever i want to get? If yes, how i can realize that?

Upvotes: 2

Views: 38

Answers (1)

Yupi
Yupi

Reputation: 4470

There is couple ways to get data from websites.

First and maybe the most popular way is parsing RSS feed from webiste. Java and Android are providing couple parsers and ways to parse xml or in this case RSS Feed. You can take a look in this examples: https://developer.android.com/samples/BasicSyncAdapter/src/com.example.android.basicsyncadapter/net/FeedParser.html

https://www.tutorialspoint.com/android/android_rss_reader.htm

Second way is getting needed informations from API if it is provided from webiste and offten that API will be in JSON format. For example https://openweathermap.org/ will return JSON file filled with informations of weather which you can pares into your app. Also Android and Java are providing couple ways to get informations from JSON format. You can take a look on this one: http://www.androidhive.info/2012/01/android-json-parsing-tutorial/

Third you can use support library called Jsoup for parsing HTML from particular webiste/s. You can find examples how to parse HTML on their offical webiste: https://jsoup.org/

Maybe there is more ways certanly you should look up for them.

Upvotes: 1

Related Questions