Homework 1: Connecting to the News Api

代写News Api作业、代做Java程序设计作业、代写JSON留学生作业、Java实验作业代写代做
Homework 1: Connecting to the News Api
Part 1
2pts: Visit this site and look around a bit: https://newsapi.org/. Sign up and get your free api key.
2pts: Past this url: https://newsapi.org/v1/articles?source=the-nextweb&sortBy=latest&apiKey=
with your api key added to the end in a browser. Cut and paste the result into a
text file and submit here. Do this before you demo your app.
1pt: In Android Studio, create a new project called "News App" with a blank activity.
5pts: Create a new class called NetworkUtils. Define the appropriate base_url and query_parameter constants (make
sure they are Java constants) here as static class members.
5pts: Create a static method in NetworkUtils that uses Uri.Builder to build the appropriate url, the url you used in (2), to
return a completed Java URL.
2pts: Put this method in your NetworkUtils class:
2pts: Set up permissions to use the internet in the manifest.
10pts: Extend and implement a subclass of AsyncTask to handle the http request. Display the results in a textview. 4pts:
Implement a search menu item. Make the item always appear in the toolbar.
(22pt)
In this part, you will add to part 1 by parsing the JSON you got from newsapi.org into NewsItem objects. These will be
displayed in a RecyclerView. When an item in the RecyclerView is clicked, a browser will be opened to the url of the
news item.
2pts: Create a NewsItem model class to store information about each news story. You need to include fields (make them
of type String) for all of the information in each item (see JSON for what those items are (they will include the article's
title and description, and url, and other things), you need to figure out what the information is from the JSON).
4pts: Create a method in some sort of utility class (NetworUtils is fine, or make another one if you want) that will parse
the JSON you received into an ArrayList<NewsItem>.
4pts: Add a RecyclerView to your activity's layout. Add a new layout for your list item. It should have a LinearLayout
with three child TextViews, one for the news item title, one for the description, and one for the time.
6pts: Implement the RecyclerView's adapter, along with the Holder as an inner class. Set up the RecyclerView so that it
displays, in each item, the item's title, description, and date (it doesn't have to be formatted, just put it in raw).
6pts: Implement click listeners for the RecyclerView's items so that, when clicked, a browser is opened to the url for
that news item (it should be stored in the relevant NewsItem object in your ArrayList).

http://www.daixie0.com/contents/9/1912.html

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codinghelp

猜你喜欢

转载自www.cnblogs.com/java222/p/9845555.html
今日推荐