What is the most efficient way to get information on any website and use it in an Android APP?

2

For example: An app that visits link and get the current dollar value and show it in the app. What are the ways to do this?

    
asked by anonymous 08.05.2018 / 01:36

2 answers

1

The most efficient way is to use a webservice .

But as we do not live in a perfect world, not always using a webservice is an option. In these cases you can use a library like jsoup to go through the HTML and fetch the information you need.

To check the website you want with jsoup, you can do the following:

Document doc = Jsoup.connect("https://dolarhoje.com/").get();
Element newsHeadlines = doc.select("#nacional").first();
String dolarHoje = newsHeadlines.attr("value");
    
08.05.2018 / 14:33
1

In general you will not get information reading a website, the most common is to use an API that returns this in a JSON or XML format. The most commonly used format is JSON because it is lightweight and fast, in which case you can use the GSON library to parse and return a java object

Depending on what you want you can use a webview , explaining in a simplified way, allows applications to open browser windows internally, without having to 'call' the browser externally, and thus opening another application, consuming more features of the smartphone.

As commented, you can also use a library that reads the HTML and then you can filter the return and show the data you want, I do not know any but I know it exists

    
08.05.2018 / 02:30