SQLite + Android – Update Table Data (Book Library App) | Part 4


We are going to create a Book Library application. Our application will have all the necessary functionality which every app with database should have. That includes CRUD, or Create, Read, Update and Delete functions. Also I’m going to teach you how to add Recyclerview and display data from our SQLite database in it. We are going to add some animations as well.

Project Files:

Part 1 (Create Database Schema) –
Part 2 (Insert Data in Database Table) –
Part 3 (Display Data in Recyclerview) –
Part 5 (Delete Table Data) –
Part 6 (Animate Recyclerview) –

One of the main principles of SQL databases is the schema: a formal declaration of how the database is organized. The schema is reflected in the SQL statements that you use to create your database. You may find it helpful to create a companion class, known as a contract class, which explicitly specifies the layout of your schema in a systematic and self-documenting way.

A contract class is a container for constants that define names for URIs, tables, and columns. The contract class allows you to use the same constants across all the other classes in the same package. This lets you change a column name in one place and have it propagate throughout your code.

🏆 My Courses:


💎 My Google Play Store:

💡 My Portfolio:

Nguồn: https://chaoticpharmacology.com/

Xem thêm bài viết khác: https://chaoticpharmacology.com/cong-nghe/


  1. I have a fragment that has the RecylerView. How would you pass the id you get from the fragment the RecylerView is in to another fragment?

  2. I did everything as explained, just couldn't figure out why the strings such as "title", "author", "pages" has green underline, the app crash when when I click on the item name for the screen that recall the details of the item for update/delete?? any ideas folks.

  3. Hi Stevdza,
    Thanx a lot for your awesome, short, fast, clear and useful tutorials,.
    Keep it up!

    However @1:31 on MyViewHolder inner class I have used ConstraintLayout for mainLayout instead of LinearLayout as it was the reason why my app crashes whenever I start the app while any data are available on the database.

    Also, on 10:41 on UpdateActivity you add 3 rows of code after
    MyDataBaseHelper db.. as following :
    title = title_input.getText().toString().trim();

    author = author_input.getText().toString().trim();

    pages = pages_input.getText().toString().trim();

    this code is add but not mentioned.

    Also, activity_update.xml <androidx.constraintlayout.widget…. should have tools:context=".UpdateActivity"

  4. At 2:11 when i am going to start the new intent it is showing me an error in calling the intent…please help sir

  5. I have done everything but when i press the update button i just see the toast message and nothing is changed in the main activity.

  6. At 11:47 onBindViewHolder method is shown and it has been changed since the last time we saw it with the override on click removed and nowhere to be seen. I try to recreate the code you show on the screen and get errors. And when I run my program the values don't show as updated please advise. Thanks.

  7. 10:42 While I watched and went through several times, I struggled with getText() functions, it was so fast to disappear on the screen so that, I thought there was another synchronizing method somehow 😂 Just letting you know.

  8. Nice
    Search option and alphabet a- z list view . Long click to edit data and onclick open Next activity and show details with title , author/description and number .
    Then user can easily able to access .data


Please enter your comment!
Please enter your name here