SQLite Database Tutorial Android Studio | Note List View App with Persistent Data
Вставка
- Опубліковано 22 лип 2024
- How to build a simple note taking app with persistent data using SQLite Database, Java and Android Studio. In this beginner friendly tutorial learn how to create an SQLite open helper java class to save, edit and delete persistent data. An excellent beginner Android App idea to follow along with to further your understanding of how to use list views and SQL Databases.
SQLite Tutorial Source Code:
github.com/codeWithCal/SQLite...
⏱️ TIMESTAMPS ⏱️
00:00 - Intro
00:53 - Note App XML
04:40 - List View Java
07:58 - SQLite Helper
13:36 - Save Data
14:25 - Edit Data
16:39 - Delete Data
#AndroidNoteApp #SQLiteAndroidStudio #AppDevelopment
Probably one of the best Android tutorials out there, great job!
How can i add api json data to sqlite database and how update, edit and delete it?
thanks for the good video But no matter how I look at it, I don't know how to link to the basic weekly list data storage. Can you give me some tips?
Hey, I have an issue. I set a custom path for my Database, but when I uninstall and reinstall the app, it says I can't open the database (which has not been deleted). So if anyone has an answer DX
hi Cal, thanks a lot for this amazing tutorial, I assuming i have the same app and i want to implement a button to share a note or some notes the user select to share them to an other device that has the app installed what is the best way to do that ? ... in short I am trying to share parts of the sqlite database how to do that ? waiting for your kind response and thanks in advance
play at 0.75%. Thank me later
I went beyond. Played at 0.50%, because I am beginner.
actually that would be 0.75 or 75% 🤓
@@monotyc6085 dead right 😅
how to add one more option in listview?
Hi, is it possible to add an image?
My Application say this "process system isnt reponding" and "myapp" keeps stopping can someone help me?. ;)
Good night friend. Do know how can i copy a database SQLITE from the assets directory to a APK? In kotlin.
great tutorial i hope you could make a tutorial where you use firebase to do the same thing as the video
Hi, first of all, great tutorial, but I do have some problems. At 7:42 when You start the app, and add notes, in Your case, after adding new notes, they show up after You click SAVE button. In my case, nothing shows up and I cant get it to work. I've tried and tried and probably redone whole project like 20 times and I still cant get my list to show up. Any ideas?
Best regards
Hi, I managed to fix it by using onResume() in MainActivity.java, simply add:
@Override
protected void onResume() {
super.onResume();
setNoteAdapter();
}
setNoteAdapter() updates the ListView and that made it work for me
Hi make sure youre created on activity class the method saveNote. May be it helps.
Hey ! Can you make an application that uses both Android and dbms . A small company app that contains details of employees and company
Hi Cal, great tutorial. Would you be able to advise how to create a dialog of Yes / No before the delete? Also, to add a filter search for the notes. Thanks
Search and Filter tutorial:
ua-cam.com/video/M73Vec1oieM/v-deo.html&ab_channel=CodeWithCal
Yes no alert dialog
stackoverflow.com/questions/2478517/how-to-display-a-yes-no-dialog-box-on-android
Hope this helps :)
I love your videos Man keep making more videos, Please make a login and registration video and a simple booking app..
Hey, thanks a lot. Firebase log in / real time DB is on the long term to do list :)
Thanks for the help broooo!!!
bro u do it?
thanks so much. I have checked Playback speed, it is still Normal
hi cal can u please tell me how I can add an image and get the date and time when the note is taken
Getting current time is as simple as
Date today = new Date();
I would then convert to a string using a date formatter, then as long as you use the same date formatter you shouldn't have any trouble converting back to date from string.
And give this a try for the image:
stackoverflow.com/questions/9357668/how-to-store-image-in-sqlite-database
Thank you, Pal
🎉
If i'm using fragments what should I use instead of intents?
I would use view pager
developer.android.com/training/animation/screen-slide
Please help. I have created a database which containing name of a product and quantity of the product , again user enter the same product name but quantity in negative or it could be in positive, now I Want to update the product and it's available quantity by performing the calculation, if user entered quantity in positive than old quantity + this new quantity, same for subtraction. How do I do this please help ,make a video on this.
That's a very specific video request.
I think you have the tools from this video to update your rows based on the user input.
Good luck 🍀
Hey cal first of all ty for the vid. I'm having a problem with SQLite which is this quote on SQLiteManager.java: try (Cursor result = sqLiteDatabase.rawQuery("Select * from " + TABLE_NAME, null)) Can you help?
What's the error you are getting?
@@CodeWithCal It was about my table name, I fixed it but thank you for the answer
I’m having issues deleting an item.. I select the button and it sends me back to the list view with the items still there. Any advice cal?
Are you filtering out deleted correctly?
Would you happen to have a version of this same tutorial for Kotlin?
No I don't, I might do a persistent data tutorial in Kotlin. It's a good idea 💡
Perfeito
please make more tutorials on android with java
Yes please
Can this method create a Room Database? Or is this different ?
Room is different, but it looks good at mapping to objects with less conversion code
The highlighted answer in this post does a great job explaining the difference.
stackoverflow.com/questions/50650077/sqlite-database-vs-room-persistence-library
thanks for the tutorial! in my emulator, the data isnt persistent. i close the app, and opened, the data isnt there.
nevermind! i forgot to add in the addtosql after appending to list
@@MaxDiegardo I have the same problem and can't figure out the solution. Could you give me some pointers?
when 6:50 i click save the note doesnot shows
same here
Please make a tutorial how to make an advanced calculator with all the equations possible without any apis with the help of java in android stuido.Thanks
Have you seen this one? ua-cam.com/video/2hSHgungOKI/v-deo.html
It's in Kotlin but you should be able to apply the principles to Java.
Kotlin is based on Java the code structure is mostly the same just some slightly different Syntax :)
@@CodeWithCal yes I have watched it,Thanks ,but I need to understand in java also
Maybe redo. Splitting the tutorial into 2 parts, so as not to be rushed.
Thanks for feedback 😊
Its great but its very very fast.
When the app is closed and reopened after that the notes duplicate, is there any solution to that?
Oversight on my behalf, we need to make sure this is method loadFromDBToMemory() is only called once.
Try creating global boolean variable firstLoad or something,
then
if(firstLoad)
{
loadFromDBToMemory();
firstLoad = false;
}
I had same problem, finally I was able to fix it.
1st created a new javacclass.
(public class FirstLoad {
public static boolean firstLoad = true;
})
2nd. Add something to Main activity
(public void load(){
if(FirstLoad.firstLoad){
loadFromDBtoMemory();
FirstLoad.firstLoad = false;
})
@Code With Call, please tell me if this is correct.
@@CodeWithCal my problem is the data duplicates on the first load after I added it
but it fixes when I close and reopen the app
What can I do?
Thank you in advance.
I have the same error, and i tried your codes for solve that and didn´t work, another solution?
@@rockfuerte Hi All, I had the same problem when using the back button the details were duplicated. The following is how I fixed it:
private static boolean firstRun = true;
private void loadFromDBToMemory()
{
if(firstRun)
{
SQLiteManager sqLiteManager = SQLiteManager.instanceOfDatabase(this);
sqLiteManager.populateFilmListArray();
sqLiteManager.close();
finish();
}
firstRun = false;
} // private void loadFromDBToMemory()
Hope this helps someone.
Great video but you are too fast for me. As a beginner I would like to have time to follow each step. Play at 0.75% don’t know what that means. Is the speed?
Please can u share source code of this note app?
github.com/codeWithCal/SQLiteTutorial
@@CodeWithCal Thank you
easy peasy lemon squeezy
seems to be a nice tutorial, but way too fast. I cant keep up, got to keep rewinding, etc...
Nice but way way too fast for me...
hey slow down
👌
It was preferable that you had done it in kotlin
Sorry Cal...
But this is not a tutorial, you just show us how you can do it if you know already all the steps....and then you do it so fast that nobody not already familiar can follow...
Obviously just my opinion but it is a honest feedback.
I am assuming you have some knowledge of programming yes.
I think this is a tutorial. It may not be a good tutorial. But It is a tutorial in my opinion 😆
If you can't follow the tutorial, slow it down, i watched it on 0.5x, pausing, and got it, it's a great tutorial, but maybe you should learn how to program before watching it and criticizing a person who just wants to help
@@debrunynha4958it would be much easier if it was much slower. And that has nothing to do with the ability to program lil bro.
@@debrunynha4958please do us a favor and be quiet
please slow down a bit this is inhuman