Starting from:

$30

ITCS5180-Homework 5 API New Channel Solved

API Setup:

1.     Sources API: https://newsapi.org/v2/sources?apiKey=<Your_Key

2.     Top                       headlines                   API:            https://newsapi.org/v2/top-headlines? sources=<Source_id&apiKey=<Your_Key


 

 

 
ABC News (AU)
 
 
 
Al Jazeera English
 
 
Ars Technica
 
Associated Press
 
BBC News
 
BBC Sport
 
Bild
 
Bloomberg                                   
 
Breitbart News
 
Business Insider
 
         (a) Main Activity loading the news sources.          (b) Main Activity ScrollView listing news sources.

Figure 1, Main Activity Wireframe

Part 1: Main Activity (
The Main activity is responsible for the loading and displaying the different sources available at NewsAPI. The requirements are as follows (Figure 1):

1.     Upon loading the Main Activity, the app should connect to the “Sources” NewsAPI api to retrieve the JSON list of the sources provided by the NewsAPI.

a)     Create a “Source” class containing variables: id and name, which should be populated from the retrieved JSON.

b)     The app should use a child thread (or AsyncTask) to perform data retrieval and data parsing.  The parsed JSON should return a list of Source objects. The list of news sources should be then returned to the Main Thread to be displayed.

c)     Display a Progress Bar during the download and parsing of the JSON as indicated in Figure 1(a). 

2.     The Source items should be displayed in a ListView. See Figure 1(b).

3.     Upon clicking a list item it should open the News Activity, you should also pass the news source Source object to the News Activity.



(a) Loading Stories in News Activity           (b) ScrollView listing the news items for BBC News

Figure 2, News Activity Wireframe

Part 2: News Activity  
This activity displays the top news items for the selected news source. The requirements are as follows:

1.     Update the activity title to display the name of the name of the news source.

2.     Upon loading the News Activity, the app should connect to the “Top Headlines” API api to retrieve the JSON list of the articles for the selected source.

a)     Create a “News” class containing variables: author, title, url, urlToImage and   publishedAt, which should be populated from the retrieved JSON.

b)     The app should use a child thread (or AsyncTask) to perform data retrieval and data parsing.  The parsed JSON should return a list of News objects. The list of news articles should be then returned to the Main Thread to be displayed.

c)     Display a Progress Bar during the download and parsing of the JSON and as indicated in Figure 2(a)

3.     The Article items should be displayed in a ListView.

a)     The image for each news item should be downloaded using the Picasso Library located at http://square.github.io/picasso/ 

4.     Upon clicking a news item it should send the url of the selected news item to the WebView Activity.

More products