Question: IN ANDROID STUDIO Consider the below table : Table BOOKS Field Type Key Id Int PRIMARY Name TEXT Author TEXT ISBN TEXT * ISBN is

IN ANDROID STUDIO Consider the below table :

Table BOOKS
Field Type Key
Id Int PRIMARY
Name TEXT
Author TEXT
ISBN TEXT

* ISBN is a serial number for a book ex : 978-3-16-148410-0

Part I :

  1. Create the Book class with all getter and setter methods to maintain single book as an object.
  2. Create the DatabaseHandler class with the appropriate extends and the onCreate and onUpdate methods.
  3. Create the method addBook(Book B) that inserts a record in the table.
  4. Create similarly the methods updateBook(Book B) and deleteBook(Book B)
  5. Create the method getListBooks() that returns a List.

Part II :

Create the below activities :

MainActivity:

  • Allows the user to create a new Book using a method from part I.
  • Have a Display button that will open ListBooksActivity when clicked.

ListBooksActivity :

  • It will display a List of all the books entered by the user in the database, using a the list method from part I
  • When the users clicks on a certain book in the list, two Buttons will then be visible : Delete and Update. A text containing the ISBN of the book will be visible also.
  • When the user clicks on the delete Button, he will be asked in a dialog box if he wants to delete the selected book, when confirmed the book will be deleted using a method from part I.
  • If the users wishes to change the ISBN of a book, he can change it in the displayed text box and click on Update button that will update the information in the database.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!