Spring 2021 Lecture & HW 8: Networking & 3rd Party APIs
Textbook: Networking & 3rd Party APIs
Lecture Video: [soon come]
Homework Instructions:
Objectives
Your task this week is to create a simple newsfeed application to display the top stories on the New York Times website. We'll provide some guidelines below, but you will have the freedom to design the UI how you like!
Requirements:
1. Your app should be making networking calls to the NYT times API, specifically their Top Stories API (link). Your networking calls should be wrapped in coroutines, and we highly recommend that you use OkHttp for making HTTP requests and Moshi for JSON parsing. You are welcomed to use other libraries, but we may not be able to help you very much.
You'll need to make an account on NYT's developer site.
2. Your app should display at least one Activity
that contains a RecyclerView
and at least 4 filter buttons. The filter buttons should correspond to sections supported by the Top Stories API (there are 26 different ones to choose from!), and the RecyclerView
should display at least 20 articles. Clicking on the filter buttons should filter the displayed list accordingly.
The list that your RecyclerView
consumes must contain objects from a custom data class, not a built-in class like String
or Int
.
3. Each cell in the RecyclerView
should, at the very least, display information about the article's title, section, and published date. You are welcome to include more information from the networking call.
4. Finally, clicking on a cell in the RecyclerView
should open up the article in an external browser app. You'll need intents for this.
Challenge Problems
These are optional challenge problems, and completing each successfully will earn you 1 extra point per problem. If you do attempt a challenge problem, make sure to include a README.txt
that states which problem(s) you've attempted!
Search Support
Add a search bar to the app that interfaces with the Article Search API (link). The HTTP response from the networking call should be displayed in some user-friendly way.
In-App Experience
Use
WebView
to display the content of the articles inside the app. This may be considerably difficult to implement 👀
References
For this assignment, you may need to figure out a few things on your own. Some classes that may be helpful for this assignment include:
For basic functionality:
Coroutines
Intent
For challenge problems:
WebView
SearchView
Last updated