Pick up news from a website automatically

Asked

Viewed 121 times

0

I am creating an app and it will have the news part , how do I make it automatically take the posts of this site? as in the following app I found on the internet. It takes the image of the post the title and a preview of the post , and clicking it sends to the site , could you help me? thanks !

inserir a descrição da imagem aqui

  • 1

    So, in an automated way, only if the site has an rss or an API and you use a client to consume. Otherwise either you show a webview or use jSoup to make html Scrap and extract the data.

2 answers

3

You have two alternatives to solve this problem:

  1. If you have developed the site you want to get the information from, also develop a API send you this information. To consume this API using Android, you can use the library Volley.
  2. If you haven’t developed the site you want to get the information from, develop a Crawler that traverses the site and saves the information in a location that you can access with your app (it can also be an online API).

0


Basically you’ll have to study the site’s API and see how it returns the data (usually a JSON string) and if you need an application key to access it. Then just implement routines to connect to the API, get JSON, Parsing it to take only the necessary data, define how to store this data (Arraylist, Database) and display them in a list (Recyclerview).

All these steps are not trivial to detail here. I gave you a macro minimum strategy, more like a Checklist.

If you want to go deeper, this course details every item I’ve cited with some projects that do exactly what you want:

https://br.udacity.com/course/android-basics-networking--ud843/

  • Thanks , helped a lot

Browser other questions tagged

You are not signed in. Login or sign up in order to post.