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

preview_player
Показать описание
🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN

🐱‍👤 Wanna become a member? Join!

📸 Instagram

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.

----------

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.
Рекомендации по теме
Комментарии
Автор

If you update data but not change anything.
Add code before db.updateData();
in file UpdateActivity.java




HausCoding
Автор

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 =
author =
pages =
db.update...

this code is add but not mentioned.

Also, activity_update.xml should have

mazenbinsalem
Автор

At minute 2:24, my parameter "int position" does not change to "final int position" and I am getting an error when running the app.
Error: Attempt to invoke virtual method 'void on a null object reference
Help, please!

alanpintor
Автор

When I select an item in the recyclerView and UpdateActivity is opened it never loads any data. The code is the same. Please help

wheepup
Автор

when I click on any card, getting all the edittexts empty, what I suppose to do?
Changes in my code-
I have made one books class and all data init to use search functionality.
And I'm using
{
Books obj;
obj.get(position);
string.valueof(obj.getid);
}
instead of
{

}
.
And I created methods like getid in books class.
is this cause of my problem?
I coded upto 5:45

TheTejasDalvi
Автор

Thanks to you I finished my project 💚💚💚

assemabujahal
Автор

Hello there, i having problems, for some reason my int position stay in red and don't actomatically change to Final int position, is also don't open the app, it's just don't work

centurionzo
Автор

How to navigate the database helper class? in the 10:40 - 10:41 seems like magic so fast can't keep up

jhazerandrade
Автор

Instead of pressing the recycler view to edit have a button (since it's only 1 person).
I did everything the same. The only difference is that I call the updateData function in a different activity. The one that contains the recycler View and the edit Button.
Since the onClick is in a different activity (the one that has the button) I didn't do the intents in the CustomAdapter, but in the Activity. they are the same without 'holder' and 'position'. like so:
Height =

Now when I enter the info and press update the app crushes. Any ideas?

I'm new at coding so I apologise if I didn't explain i very well

wheepup
Автор

how would you implement update if you arent using auto-incremented id's??

papermaker
Автор

Hi Stev, unfortunately as of February 2022 this does not work as getposition is deprecated. Please can you do an update? Thanks

janettaylor
Автор

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.

Waleed_Al-Haidary
Автор

onactivityresult isnt working...any help...i work with fragmetns

puch
Автор

is it possible to update only in an specific column?

hunsendrake
Автор

as the onActivityResult would do in a fragment what you explain in minute 12.18
regards

miguelangelmunozoscategui
Автор

Is IT possibile to download all three parts? Update button doesnt work😢

skanerkodowkreskowychqr
Автор

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.

alexnewcomer
Автор

Hello sir, can you help me again? When i click the data in main activity and i want to update the data, it only shows toast message no data.

cjdrix
Автор

is there a code for me to follow where i could add a button as a counter for the books entered and display the number as well?

juanenriquez
Автор

what is the version of android studio and jdk you are using thank you?

christianreydoctolero
join shbcf.ru