In this midterm exam assignment you will develop a news app. The app will enable the user to select the news source and will display the news for the selected news source. The api used for this assignment is the News API https:// newsapi.org/ .
API Setup:
- Sources API: https://newsapi.org/v2/sources?apiKey=<Your_Key>
- 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):
- 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.
- Create a Source class containing variables: id and name, which should be populated from the retrieved JSON.
- 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.
- Display a Progress Bar during the download and parsing of the JSON as indicated in Figure 1(a).
- The Source items should be displayed in a ListView. See Figure 1(b).
- 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:
- Update the activity title to display the name of the name of the news source.
- 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.
- Create a News class containing variables: author, title, url, urlToImage and publishedAt, which should be populated from the retrieved JSON.
- 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.
- Display a Progress Bar during the download and parsing of the JSON and as indicated in Figure 2(a)
- The Article items should be displayed in a ListView.
- The image for each news item should be downloaded using the Picasso Library located at http://square.github.io/picasso/
- Upon clicking a news item it should send the url of the selected news item to the WebView Activity.
Part 3: WebView Activity
This activity should display the url of the news item in a WebView. Please use the instructions at https://developer.android.com/reference/android/webkit/ WebView.html to correctly setup the WebView component.

![[Solved] ITCS5180 Android-API-new-channel-hw05](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] ITCS5180 Homework 1-BMI Calculator solved](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.