Question
IN JAVA LANGUAGE You application will use a Web Service API (See Appendix below) to fetch book information, and display that information in its various
IN JAVA LANGUAGE
You application will use a Web Service API (See Appendix below) to fetch book information, and display that information in its various modes. You application will allow a user to retrieve all available book titles available via the API, as well as allow a user to search for a subset of titles that match a user-proved search string.
-
Create a Book class in your application that contains the following fields for a book:
-
id: int – A system provided ID for the book
-
title: String – The title of the book
-
author: String – The author of the book
-
published: int – The year the book was published
-
coverURL: String – A URL to the image representing the book cover
-
-
Use either an ArrayList (ArrayList
) or your own collection class to keep a collection of book objects. -
Modify BookDetailsFragment to accept a Book object instead of just a String title, and have it display the book cover image, the book title, the author and the year published.
-
Modify your main activity to query the provided book search API when your activity loads. When queried, the API will return all available books. The returned titles should be used to populate the collection of books (requirement 2), and allow the user to browse
1. This start-up query should only be performed the first time the activity loads – If the activity is reloaded (because of a configuration change, such as rotating the device), then the activity should not reload the data, but should instead fetch the list of books from the last fragment that contained it. More information is provided in the next item.
-
Modify your BookListFragment and your ViewPagerFragment to have a public method that returns the list of books that it is currently displaying. From time to time the activity may fetch the set of books from one fragment and pass it to another. We are relying on the fact that fragments are retained during activity restarts.
-
In your activity, add a search function (An EditText to allow the user to enter a search term, and a button to begin the search).
1. When a user performs a search, they will receive a subset of books which may include zero, some, or all available books.
2. A user can search for books based on title, author, or published year
-
When a search result is returned, the collection of books being displayed to the user should be updated to only show the books returned
-
Once the list of books have been searched for and the display updated (whether being displayed in a ListView or a ViewPager), that subset of books must always be displayed until the user performs a new search, even if the activity is restarted. Utilize the public method mentioned in Item 5 to fetch the books from a fragment A, when that fragment is about to be replaced with a fragment B.
Step by Step Solution
3.33 Rating (162 Votes )
There are 3 Steps involved in it
Step: 1
Introduction This document is intended for developers who want to write applications that can interact with the Google Books API Google Books has the vision to digitize the worlds books You can use th...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started