Starting from:

$25

ITIS/ITCS5180-Assignment 6 News Application Solved

In this assignment we are going to develop a news application using the newsapi.org JSON API. Follow the following steps to setup the API:

•        Create a new account and register as a developer at https://newsapi.org/register  •  Get an API Key to be used for this application.

•        In this application we are going to use the top headlines api, for information check the following link https://newsapi.org/docs/endpoints/top-headlines  

 

Figure 1, Application Wireframe

Connecting with the API 

The interface should be created to match the user interface (UI) presented in Figure 1. You will be using layout files, and strings.xml to create the user interface. Perform the following tasks:

1.      This app should use the top headlines api to retrieve news items from the USA and for the category selected by the user. The possible categories are business, entertainment, general, health, science, sports, and technology as indicated in the api documentation at https://newsapi.org/docs/endpoints/top-headlines  

2.      Clicking on the “Go” Button should display a list of categories as shown in Figure 1.

You can either Alert Dialog or Spinner to implement it.

3.      Clicking on a category should do the following:

a)     The TextView will hold the search category clicked by the user.

b)     Use AsyncTask/Thread to connect to the top headlines to retrieve and parse the JSON returned for the selected category. The AsyncTask/Thread class should be in a separate file/class not inner to the main thread. i.e. You should manage passing parameters to the class and then pass back the result image downloaded to the UI.

4.      When the api data is retrieved:

a)     Display the first news item from the list of retrieved news items as shown in Figure 1.

b)     Use Picasso to retrieve and display the first image associated with the displayed news item and display it in the ImageView.

5.      The Next and Previous news item icons should be disabled when the application is launched, and enabled after the first news item is displayed. The buttons will also remain disabled in the case there is only 1 or 0 news items corresponding to the provided category. Use icons provided in Support Files for setting the image icons (next.png, prev.png)

6.      Do not store the photos, simply download and display the retrieved photos. Also do not attempt to download all the URLs receive, and your app should only download and display a single news photo at any given time.

7.      Upon clicking the “Next” icon, you should display the next news item from the retrieved news items and download the news photo accordingly. If the currently displayed news item happens to be the last news item, you should display the news item at index 0 (first news item) and download the news photo accordingly.

8.      Clicking the “Previous” icon, you should display the previous new item from the retrieved news items and download the news photo accordingly. If the currently displayed news item happens to be the first news item, you should display the last news item and download the news photo accordingly.

9.      Notice the “1 out of 20” text at the bottom of the screen, this should be updated according to the currently displayed news item.

10.  If the api returns an empty list of news items then clear the currently displayed news item and display an error Toast message “No News Found”.

11.  Your application should connect with the api and download the requested photo only if there is an established internet connection. If there is no internet connection you should display a Toast message indicting that there is no internet connection and do not attempt to send the HTTP request.In this assignment we are going to develop a news application using the newsapi.org JSON API. Follow the following steps to setup the API:

•        Create a new account and register as a developer at https://newsapi.org/register  •  Get an API Key to be used for this application.

•        In this application we are going to use the top headlines api, for information check the following link https://newsapi.org/docs/endpoints/top-headlines  

 

Figure 1, Application Wireframe

Connecting with the API 

The interface should be created to match the user interface (UI) presented in Figure 1. You will be using layout files, and strings.xml to create the user interface. Perform the following tasks:

1.      This app should use the top headlines api to retrieve news items from the USA and for the category selected by the user. The possible categories are business, entertainment, general, health, science, sports, and technology as indicated in the api documentation at https://newsapi.org/docs/endpoints/top-headlines  

2.      Clicking on the “Go” Button should display a list of categories as shown in Figure 1.

You can either Alert Dialog or Spinner to implement it.

3.      Clicking on a category should do the following:

a)     The TextView will hold the search category clicked by the user.

b)     Use AsyncTask/Thread to connect to the top headlines to retrieve and parse the JSON returned for the selected category. The AsyncTask/Thread class should be in a separate file/class not inner to the main thread. i.e. You should manage passing parameters to the class and then pass back the result image downloaded to the UI.

4.      When the api data is retrieved:

a)     Display the first news item from the list of retrieved news items as shown in Figure 1.

b)     Use Picasso to retrieve and display the first image associated with the displayed news item and display it in the ImageView.

5.      The Next and Previous news item icons should be disabled when the application is launched, and enabled after the first news item is displayed. The buttons will also remain disabled in the case there is only 1 or 0 news items corresponding to the provided category. Use icons provided in Support Files for setting the image icons (next.png, prev.png)

6.      Do not store the photos, simply download and display the retrieved photos. Also do not attempt to download all the URLs receive, and your app should only download and display a single news photo at any given time.

7.      Upon clicking the “Next” icon, you should display the next news item from the retrieved news items and download the news photo accordingly. If the currently displayed news item happens to be the last news item, you should display the news item at index 0 (first news item) and download the news photo accordingly.

8.      Clicking the “Previous” icon, you should display the previous new item from the retrieved news items and download the news photo accordingly. If the currently displayed news item happens to be the first news item, you should display the last news item and download the news photo accordingly.

9.      Notice the “1 out of 20” text at the bottom of the screen, this should be updated according to the currently displayed news item.

10.  If the api returns an empty list of news items then clear the currently displayed news item and display an error Toast message “No News Found”.

11.  Your application should connect with the api and download the requested photo only if there is an established internet connection. If there is no internet connection you should display a Toast message indicting that there is no internet connection and do not attempt to send the HTTP request.

More products