Guyz. There was some sort of update to SQLite. If you want to see whats in ".db" file you need to extract all three files located in "database" folder (If you have only 2 files as showed in video, then you can use method from the video, I guess). Next you need to open them in a manager, that supports opening multiple files. "DB Browser for SQLite" works perfectly, but you need to install it (it's free though). I've spent several hours debugging why is my .db file empty and why there is no table at all. So try to put this comment to the top, so others can save some time :D Thx.
For those who do not see content in data folder (steps are really simple just exaggerated!) which is actually there but you don't have permission to see it via android device monitor 1. file-> project structure -> (copy SDK file location) -> (open SDK file in file explorer)->(you will see a folder 'platform-tools' click on it) -> (copy this file location) 2. ->now press 'win+r' (to open run)->type 'cmd' -> just type this 'cd /d (your location that you have copied)' 3. now type adb root -> press enter 4. now come back to android studio rebuild the Gradle and now you should be able to see the file or 4. come back to the android studio on the right-hand bottom corner you will see 'Device File Explorer' written vertically just press on that. right click on your database to save it somewhere.
Great tutorial. If anyone's Android Device Monitor will not open and throws an error, try running Android Studio as the administrator. It worked for me!
For those who cannot seem to get the data folder expanding, try using the emulator. For me the case was that it wouldnt expand while connected to a real device but when using a emulator on pc it worked.
For anyone having issues 3 things need to be checked: 1. Running Android Studio as administrator 2. Make sure after "CREATE TABLE" there is a space. Eg. "CREATE TABLE " + .... also if you are using the variables instead of hard coding the values in, put a space in front of the variable properties. Eg. " INTEGER PRIMARY KEY AUTOINCREMENT," ... my full string is: "CREATE TABLE " + TABLE_NAME + "(" + COL_1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COL_2 + " TEXT," + COL_3 + " TEXT," + COL_4 + " TEXT"+ ")" 3. Make sure you are running an emulator with a lower API, users have stated 23 and below, I am using 22. Thanks to everyone who posted their solutions in the comments. Lifesavers
Those who are facing problem finding Database File inthe newer version, Open File Explorer on the right hand side (if you see files then you're good to go and if you can't then) > run your program or virtual device you'll be then able to see your files. Like this comment so others can get help it took me 15 minutes to realize and find this in the newer android version.
Sorry to be a bother, and I know this is 6 months later, but I cannot seem to find my folder after opening database file and searching in folder data > data. I also don't think I saved it anywhere else.
Outstanding!!! Thank you very much for your SQLite database connectivity tutorial, slowly explain everything. I don't have any word to describe it. I wish you all the success in life and definitely you will for high level in IT. Brilliant.....
Good day sir! Why does the TABLE in CREATE TABLE became red? It says that INDEX, TABLE, TEMP, TEMPORARY, TRIGGER, UNIQUE, VIEW or VIRTUAL expected, got tableregisteration (which is the table name I put)? Your tutorials are life saving for a beginner like me. Please help :(
Fix it if ur db is not showing :- If you are using an actual device, you will not be able to see or access it from outside unless you root your phone. If you are using the emulator, the DDMS view will let you navigate to it and pull it from there.
Awesome tutorials mate.Are you going to create more Android tutorials? Would be awesome if you combine with some database and create an app or something.
i think you skip a part? i followed your instruction but ive got an error. is says error: constructor DatabaseHelper in class DatabaseHelper cannot be applied to given types;
The database won't be created until you call getWritableDatabase() or getReadableDatabase(). Something to keep in mind if the databases aren't showing up for you
hi, please enable closed captions? I was able to see the captions with the First tutorial, but seems disabled for this one and the next. :( I'm deaf and dependent on the subtitles to hear what you're saying. "there is no CC button displayed, that means the RUclips channel owner has disabled captions"
No database is created when I use the same code. When the application was executed in debug mode, I found out that the onCreate() method was not called. How to solve this issue?
Hey Bro field of table that was i trying to created are id,name,cont no,area bt it will give me this error that Error:Failed to capture snapshot of output files for task 'transformClassesWithDexForDebug' property 'streamOutputFolder' during up-to-date check. > Failed to create MD5 hash for file 'C:\Users\Dell\AndroidStudioProjects\DBApp\app\build\intermediates\transforms\dex\debug\folders\1000\5\slice_3\classes.dex'. so how i solve this
Mine works except the database is not created. I checked using all different ways explained in the video, but it just not there. I can't find it on ANdroid Device Monitor and same when using SQLiteManager on Firefox. Please help, the code compiles without problem using a virtual emulator. I am confused and lost
hello sir, I got a true reply with Toast but when it is opened with DB Browser SQLite no table found... I'm not getting what is the error,, Please respond sir
Thanks for the video. Do you happen to know how to save the .db (or .csv) in another location instead of the default folder (/data/data)? E.g. on your SD card or the "Downloads" folder. I'm asking because when running the app of an actual phone (not emulator), you can't access where the app stores the .db unless the phone is rooted. I would like to retrieve the created .db to my PC. Thanks in advance.
If this is made for API 23 (So you can see the database on ADM), what is the solution for API 25 (Nougat)? I mean is there a way on API 25 to see de database file on ADM?
If I want to create two or more tables in sqlite and android studio.., How I can code with this? Please reply me asap because Im doing the android project. Thank you.
A fix that stopped crashes for me: In DatabaseHelper.class, look at the constructor. Change super(context, DATABASE_NAME, null, 1); to super(context, DATABASE_NAME, null, 2); The program was working on my emulator (API 23) but not my phone (API 25). You can see the database files in Android Data Monitor if you are using an emulator/phone that is API 23 or older, otherwise I don't think you can view the files unless your emulator/phone is rooted. I spent like 6 hours trying to figure this out. The solutions that were popping up were using external storage (I didn't want to stray too far from this tutorial's setup), change the target API (23 instead of 25, but didn't work), rooting phone (I didn't want to root my phone), or doing some shell commands (I didn't have proper permissions). I was looking at my Android Monitor and it was saying it couldn't find the file and was pointing to my getAllData() function in DatabaseHelper.class (getAllData() is covered in a later video in this series). Then, I started messing with anything that looked like could be changed. In the constructor I changed a 1 to 0 and the program crashed immediately. I then changed it to a 2 and it worked. I don't know why it worked, but it worked.
Sorry sir. I was creating a connection between my laptop and my mobile phone, and just find database in data/android... when choosing view/tool windows/device file explore. So, how can I manipulate with tool: SQLite Manager to open database like choosing view/tool windows/device file explore ??
Larry Tsai Had the same problem with the device monitor, the folder wouldn't open/drop down when i clicked it. I just looked at it on my phone instead. I found two ways, either download a sqlite manager to your phone from google play and give it superuser/root access, navigate to /data/data/com.xxx.xxx/the appname /other folder/ so on /databases/ then you can see your database on your phone. Or use your file explorer if you have one and send the .db file to your computer in your normal way you send files. I use ES file explorer BUT you need to toggle the root explorer button on it aswell. When ES file explorer open, open the left "slide"/fas-accesst" menu, either slide from left to right or click the three lines up in the let corner. Find tools , then toggle the root-explorer button to on. And you should be able to navigate in the /data/data-files. I see you have your phone rooted, but to anyone else who reads this. I'm pretty sure you need a rooted phone for this to work.
I am not getting my project name when Clicks on the Android Device Manager............Please help me to solve this and my database in Firafox is allso not connecting............
if suppose I created the table and write its respective code in main method then where should i find the created table details. please help with this. reply as early as possible. thankq in advance
Did you do anything in 5:48 because i see more classes than the 3 u had previously?? I have the problem in which wheni search in the DDMS i click on data>data> (and all i see are com or con files and i cant even open them.... any halp?
I have write the same code but when going android device monitor data is not going open, what should I do, Sir @ProgrammingKnowledge please guide for this issue because some people I also facing this problem so please reply!!!
i had errors with " SQLiteDatabase db = this.getWritableDatabase(); " i'm using real phone.. is there something wrong with your code upon creating db in file manager?
I am not getting any error while running the app. but I cant see the database. in android monitor. Following is my code. public class DatabaseHelper extends SQLiteOpenHelper { public static final String Database_Name = "Student.db"; public static final String Table_Name ="student_table"; public static final String Col_1="ID"; public static final String Col_2="Name"; public static final String Col_3="Surname"; public static final String Col_4="Marks"; public DatabaseHelper(Context context) { super(context, Database_Name, null, 1); } @Override public void onCreate(SQLiteDatabase sqLiteDatabase) { sqLiteDatabase.execSQL("create table "+ Table_Name +"ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, SURNAME TEXT, MARKS INTEGER"); SQLiteDatabase db = this.getWritableDatabase(); } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { sqLiteDatabase.execSQL("DROP TABLE IF EXISTS "+ Table_Name); onCreate(sqLiteDatabase); } } Main Activity. public class MainActivity extends AppCompatActivity { DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new DatabaseHelper(this); } }
Hi, I'm using a latest version of firefox. Its saying that sqlite manager has been removed in a previous release. Its suggesting a way to download another version of firefox. Is there any other way to have sqlite manager easily?
Hello Sir, i am typing a same code in our program but not connect to data base . the error is show Unfortunately, xyz has stopped. please tell me how to solve this error .
Sir, im fed up with a problem that the app will crash when i include the command SQLiteDatabase db = this.getWritableDatabase(); on the constructor. give me the solution for that. im using android studio 2.3.3
Sir pls can you tell me what this "Unexpected error while parsing input:Invalid ui automator heirarcy file" error mean is? i am creating database in android studio but A stdio is showing this messege. All of my coding is same to your code but i dont know why it show this error messege.
hI, my android device monitor keeps throwing me an error. is there any possible way to view my database? btw im not using emulator, i directly connect my phone to debug. TIA
Hi there guys :D I've done reading comments regarding with your problems, and i conclude that there is 2 major problem that most of you are facing right now : Problem #1 : The app cant open and keeps closing. Problem #2 : The data folder can't be open. Okay I'm not here to be a hero or so what.. I'm here just to share what I've learned.. I'm not good with this language and yeah me too also takes so much hard time to solve these problems. Okay here's the solutions : 1. Repair the public void onCreate(SQLiteDatabase db) in DatabaseHelper.java class : Here's the code : public void onCreate(SQLiteDatabase db) { String SQL_String = "CREATE TABLE " + TABLE_NAME + "(" + COL_1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COL_2 + " TEXT," + COL_3 + " TEXT," + CoL_4 +"INTEGER"+ ")"; db.execSQL(SQL_String); } Credits to +MickyM 2. Try to run the Android Studio in Administrator and if the device you're using to run the app is a real Android Device (not Virtual or Emulator) you must root your device first and if you're using an emulator you must run the "Android Device Monitor" in 23 API (or Lower APIs), APIs above 23 can cause problems when deploying Android Device Monitor. (I recommend the API 22 or the Lollipop version of Android OS). You can see it here : stackoverflow.com/questions/34603355/android-device-monitor-data-folder-is-empty Credits to +Scott Chow
i have same problems here db.execSQL("create table" +TABLE_NAME+"(id INTEGER PRIMARY KeY AUTOINCREMENT, name TEXT,surname TEXT,marks INTEGER ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS"+TABLE_NAME); OnCreate(db);
You need to have your emulator running with your app in order to see it show up in the ADM. Also, in order to view the individual files you should be running with an API of 23.
Thanks for your reply, it much appreciated, however i would like your help. I m creating a College Project which includes databases and im struggling on few things like adding Gender column. May i please send you my code and edit for me where and how radio buttons should go.
0:00 add your extra column 3:56 include your extra column in create when you add to your db, just include your extra column with everything else what you're looking for is exactly what ProgrammingKnowledge is showing you step by step. if you're still confused, just watch the videos again
Hi, I am trying to use it in fragment class. (not in main activity) and i am able to connect my fragment class to database class with this method that you just showed "myDB = new StudentsDatabase(this);" what do i need to do in order to connect my database class to fragment class? anyone? any help?
Guyz. There was some sort of update to SQLite. If you want to see whats in ".db" file you need to extract all three files located in "database" folder (If you have only 2 files as showed in video, then you can use method from the video, I guess). Next you need to open them in a manager, that supports opening multiple files. "DB Browser for SQLite" works perfectly, but you need to install it (it's free though).
I've spent several hours debugging why is my .db file empty and why there is no table at all. So try to put this comment to the top, so others can save some time :D Thx.
saved my life there bro. Here I was thinking that am stupid that I am not even able to make a different table after watching the tutorial.
Saved my time..thanks !!!
Had everything perfect then thought it was broken. Thank you so much!
Thank you dude
God spotted here
For those who do not see content in data folder (steps are really simple just exaggerated!) which is actually there but you don't have permission to see it via android device monitor
1. file-> project structure -> (copy SDK file location) -> (open SDK file in file explorer)->(you will see a folder 'platform-tools' click on it) -> (copy this file location)
2. ->now press 'win+r' (to open run)->type 'cmd' -> just type this 'cd /d (your location that you have copied)'
3. now type adb root -> press enter
4. now come back to android studio rebuild the Gradle and now you should be able to see the file
or
4. come back to the android studio on the right-hand bottom corner you will see 'Device File Explorer' written vertically just press on that. right click on your database to save it somewhere.
Great tutorial.
If anyone's Android Device Monitor will not open and throws an error, try running Android Studio as the administrator. It worked for me!
+Conor I am still getting "An error has occurred" with a reference to a log file, even after running as administrator. What else should I do?
Or, you can try " Device File Explorer". It's work for me.
Maksym Kovalenko you saved me
For those who cannot seem to get the data folder expanding, try using the emulator. For me the case was that it wouldnt expand while connected to a real device but when using a emulator on pc it worked.
***** Thanks. I was having the same problem. It appears that you need your device to be rooted to be able to access the folders.
+aka Linxy Thanks, worked for me.
emulator still doesnt expand :/
Thank you for explaining about creating database and table sqlite sir.. Hopefully will help us to doing some final year project
Hear yourself at 1.5 speed. Looks perfect during explanations.
Your tutorial is very clear. I had no problem to follow every step. Thanks for all of your efforts and Generosity !
For anyone having issues 3 things need to be checked:
1. Running Android Studio as administrator
2. Make sure after "CREATE TABLE" there is a space. Eg. "CREATE TABLE " + .... also if you are using the variables instead of hard coding the values in, put a space in front of the variable properties. Eg. " INTEGER PRIMARY KEY AUTOINCREMENT," ... my full string is:
"CREATE TABLE " + TABLE_NAME + "(" + COL_1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COL_2 + " TEXT," + COL_3 + " TEXT," + COL_4 + " TEXT"+ ")"
3. Make sure you are running an emulator with a lower API, users have stated 23 and below, I am using 22.
Thanks to everyone who posted their solutions in the comments. Lifesavers
Those who are facing problem finding Database File inthe newer version, Open File Explorer on the right hand side (if you see files then you're good to go and if you can't then) > run your program or virtual device you'll be then able to see your files.
Like this comment so others can get help it took me 15 minutes to realize and find this in the newer android version.
Sorry to be a bother, and I know this is 6 months later, but I cannot seem to find my folder after opening database file and searching in folder data > data. I also don't think I saved it anywhere else.
I couldn't use db until I saw your videos, thank you :)
for new viewers who dont find Android/android device monitor...it's on the bottom right corner of your android studio..device file explorer
Very helpful...most other videos do not go this in depth. Thanks!
Device file explorer is what you should refer. Search it and open it. Go to data-) data-) find your app and click databases.
09:03
In Latest Version(from 3.1) u can get db file directly at bottom right --> Device File Explorer
Good call! Android Device Monitor was deprecated as of Android Studio 3.1
Outstanding!!! Thank you very much for your SQLite database connectivity tutorial, slowly explain everything. I don't have any word to describe it. I wish you all the success in life and definitely you will for high level in IT. Brilliant.....
In Android Studio 3.1 or higher You can open the database by:
View>Tool Windows>Device File Explorer>data>data>appname>database
Solution for not opening data base!
You just have to use an emulator with lower api then 23. I used 19 and it worked for me.
I'm using api 19 in emulator still same problem
For those who don't use Firefox, SQLite Viewer with Google Drive plugin in Chrome seems good enough.
Thanks for telling us about the Firefox addon :) It was really a big help to check if the database is created right or not :)
Good day sir! Why does the TABLE in CREATE TABLE became red? It says that INDEX, TABLE, TEMP, TEMPORARY, TRIGGER, UNIQUE, VIEW or VIRTUAL expected, got tableregisteration (which is the table name I put)? Your tutorials are life saving for a beginner like me. Please help :(
Thank you very much! You helped me a lot and I understood the explanations as well.
Thank you for this very clearly class! Keep it up, mate!
Fix it if ur db is not showing :-
If you are using an actual device, you will not be able to see or access it from outside unless you root your phone.
If you are using the emulator, the DDMS view will let you navigate to it and pull it from there.
1.what is cursorfactory?
2.Why should we give cursorfactory as null?
3.when should we use it? and how?
can anyone explain pls!!!!!
Awesome tutorials mate.Are you going to create more Android tutorials? Would be awesome if you combine with some database and create an app or something.
Thank you. The Tutorial was so helpful. Everything was working perfect.
i think you skip a part? i followed your instruction but ive got an error. is says error: constructor DatabaseHelper in class DatabaseHelper cannot be applied to given types;
that firefox trick was nice
This video has few mistakes but thanks for sharing this with everyone!
The database won't be created until you call getWritableDatabase() or getReadableDatabase(). Something to keep in mind if the databases aren't showing up for you
GREAT VIDEO! WHAT IF I WOULD USE 4 TABLES, WHERE DO I CREATE IT? WHAT ABOUT FOREIGN KEYS? THANKS!
Thank you for your good explanation
Can you explain how to make relations between tables
This is my second comment on this video please help me that data folder is not open when clicking on it. please guide as soon as possible Thank you
hi, please enable closed captions? I was able to see the captions with the First tutorial, but seems disabled for this one and the next. :( I'm deaf and dependent on the subtitles to hear what you're saying.
"there is no CC button displayed, that means the RUclips channel owner has disabled captions"
Thank you very much!. Really helpful and straight forward!
Nicely explain....☺️
Woo hoo thanks alot sire, it helped me very much..
thanks for the excellent tutorial and the sqlite trick for firefox
Thank you sir.... that's really helpful... many thanks..
Thank you Sir! Saved me a lot of time
Thank you very much , your tutorials helped me alot
Great video man!
thank you so much ! well explained, such clarity!
After Creating it ones will it be stored in device memory permanently or it will be created after u open the app??
If you cannot view the files in the Android Device Manager, try using an emulator with an API level of 23.
No database is created when I use the same code. When the application was executed in debug mode, I found out that the onCreate() method was not called. How to solve this issue?
Hey Bro
field of table that was i trying to created are id,name,cont no,area bt it will give me this error that
Error:Failed to capture snapshot of output files for task 'transformClassesWithDexForDebug' property 'streamOutputFolder' during up-to-date check.
> Failed to create MD5 hash for file 'C:\Users\Dell\AndroidStudioProjects\DBApp\app\build\intermediates\transforms\dex\debug\folders\1000\5\slice_3\classes.dex'.
so how i solve this
Thanks for the glimpses on Firefox Add-on :)
Fantastic. Thank you for making this.
i have enjoyed this video
Mine works except the database is not created. I checked using all different ways explained in the video, but it just not there.
I can't find it on ANdroid Device Monitor and same when using SQLiteManager on Firefox.
Please help, the code compiles without problem using a virtual emulator. I am confused and lost
hello sir,
I got a true reply with Toast but when it is opened with DB Browser SQLite no table found... I'm not getting what is the error,, Please respond sir
Thanks for the video. Do you happen to know how to save the .db (or .csv) in another location instead of the default folder (/data/data)? E.g. on your SD card or the "Downloads" folder. I'm asking because when running the app of an actual phone (not emulator), you can't access where the app stores the .db unless the phone is rooted. I would like to retrieve the created .db to my PC. Thanks in advance.
Very Simple Solution is that Change your api level to 23 to below
Over 23 it won't work
Thanks
If this is made for API 23 (So you can see the database on ADM), what is the solution for API 25 (Nougat)? I mean is there a way on API 25 to see de database file on ADM?
Can you please explain how to import an already existing database into my app. i have a huge.sql file which i want to use in my android app.
If I want to create two or more tables in sqlite and android studio.., How I can code with this? Please reply me asap because Im doing the android project. Thank you.
A fix that stopped crashes for me:
In DatabaseHelper.class, look at the constructor. Change
super(context, DATABASE_NAME, null, 1);
to
super(context, DATABASE_NAME, null, 2);
The program was working on my emulator (API 23) but not my phone (API 25). You can see the database files in Android Data Monitor if you are using an emulator/phone that is API 23 or older, otherwise I don't think you can view the files unless your emulator/phone is rooted.
I spent like 6 hours trying to figure this out. The solutions that were popping up were using external storage (I didn't want to stray too far from this tutorial's setup), change the target API (23 instead of 25, but didn't work), rooting phone (I didn't want to root my phone), or doing some shell commands (I didn't have proper permissions). I was looking at my Android Monitor and it was saying it couldn't find the file and was pointing to my getAllData() function in DatabaseHelper.class (getAllData() is covered in a later video in this series). Then, I started messing with anything that looked like could be changed. In the constructor I changed a 1 to 0 and the program crashed immediately. I then changed it to a 2 and it worked. I don't know why it worked, but it worked.
Sorry sir. I was creating a connection between my laptop and my mobile phone, and just find database in data/android... when choosing view/tool windows/device file explore. So, how can I manipulate with tool: SQLite Manager to open database like choosing view/tool windows/device file explore ??
Thanks for tutorial, I tried access my /data/data folder but it doesn't drop any of my folders down... I rooted my phone but still no luck. Any Ideas?
Larry Tsai Had the same problem with the device monitor, the folder wouldn't open/drop down when i clicked it. I just looked at it on my phone instead. I found two ways, either download a sqlite manager to your phone from google play and give it superuser/root access, navigate to /data/data/com.xxx.xxx/the appname /other folder/ so on /databases/ then you can see your database on your phone. Or use your file explorer if you have one and send the .db file to your computer in your normal way you send files. I use ES file explorer BUT you need to toggle the root explorer button on it aswell. When ES file explorer open, open the left "slide"/fas-accesst" menu, either slide from left to right or click the three lines up in the let corner. Find tools , then toggle the root-explorer button to on. And you should be able to navigate in the /data/data-files.
I see you have your phone rooted, but to anyone else who reads this. I'm pretty sure you need a rooted phone for this to work.
I am not getting my project name when Clicks on the Android Device Manager............Please help me to solve this and my database in Firafox is allso not connecting............
THIS IS SO AWESOME ! THANKS FOR THIS!
if suppose I created the table and write its respective code in main method then where should i find the created table details. please help with this. reply as early as possible. thankq in advance
Did you do anything in 5:48 because i see more classes than the 3 u had previously?? I have the problem in which wheni search in the DDMS i click on data>data> (and all i see are com or con files and i cant even open them.... any halp?
Thank you very much for this perfect video!
I have write the same code but when going android device monitor data is not going open, what should I do, Sir @ProgrammingKnowledge please guide for this issue because some people I also facing this problem so please reply!!!
The Data Folder wouldn't open for me either. I wouldn't recommend watching this and expecting a working end product.
How to extract student table from device file explorer?
I try more time also my code is the exact copy of video code but the data cannot inserted whats the problem.please reply as soon as possible
this video is very helpful but when I run at my android 3.5 got some issues
i had errors with " SQLiteDatabase db = this.getWritableDatabase(); " i'm using real phone.. is there something wrong with your code upon creating db in file manager?
My app stopped suddenly showing "fatal exception" in android monitor and I checked whether the table is created. And the table is also not created.
I am not getting any error while running the app. but I cant see the database. in android monitor. Following is my code.
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String Database_Name = "Student.db";
public static final String Table_Name ="student_table";
public static final String Col_1="ID";
public static final String Col_2="Name";
public static final String Col_3="Surname";
public static final String Col_4="Marks";
public DatabaseHelper(Context context) {
super(context, Database_Name, null, 1);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("create table "+ Table_Name +"ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, SURNAME TEXT, MARKS INTEGER");
SQLiteDatabase db = this.getWritableDatabase();
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS "+ Table_Name);
onCreate(sqLiteDatabase);
}
}
Main Activity.
public class MainActivity extends AppCompatActivity {
DatabaseHelper db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new DatabaseHelper(this);
}
}
what is the use of drop table query in onUpgrade method?? i mean what does it exacly do??.
in android device monitor file explorer data/data it only show a lot of "cons" folder. there is no package name. how to solve this please. thank you
+Gigam Gamboa yeah same problem, did u find any solution
I got the same problem here. Anyone have the solution now? Please help
i got the same problem
Hi, I'm using a latest version of firefox. Its saying that sqlite manager has been removed in a previous release. Its suggesting a way to download another version of firefox. Is there any other way to have sqlite manager easily?
Hello Sir,
i am typing a same code in our program but not connect to data base . the error is show Unfortunately, xyz has stopped.
please tell me how to solve this error .
device monitor is not shown in the updated android studio. please help!! new 2019 November update
I run the code and works but how can see if database exists in real device? I searched the app folder and I didn't see nothing.
I couldn't find the db file in the Device File Explorer. When I opened the database folder, it showed that there was nothing there
HI GUYS I CANT SEEM TO FIND THE ANDROID OPTION for device monito ON THE TOOL DROP DOWN BOX...ANY IDEA i am using android studio 3.1.1 version
Well explained, thank you!
Can i ask a question about other things? but still about android studio
My File Explorer shows no files at all - any ideas on how to solve this issue :S ? By the way: Great tutorial (!)
Run emulator with an API of 23.
Mine too,did you find a solution after 4 months?
by the way if the app is crashing make sure you have space after table like this "create table "+ TABLE_NAME
Thank you!
I'm doing it step by step, but when I want to star app on emu then shows " App has stopped" ;/ Where I do wrong ?
hello ProgrammingKnowledge by using your database code is there a way to create multiple table using a the same Database
Sir,
im fed up with a problem that the app will crash when i include the command SQLiteDatabase db = this.getWritableDatabase(); on the constructor.
give me the solution for that. im using android studio 2.3.3
Sir pls can you tell me what this "Unexpected error while parsing input:Invalid ui automator heirarcy file" error mean is? i am creating database in android studio but A stdio is showing this messege. All of my coding is same to your code but i dont know why it show this error messege.
hI, my android device monitor keeps throwing me an error. is there any possible way to view my database? btw im not using emulator, i directly connect my phone to debug. TIA
my andoroid divice monitor doesn't show me any divices. what should i do? thank you in advance!
I am using bluestacks as an emulator, where can I find the database and the table???
Thanks
Hi there guys :D I've done reading comments regarding with your problems, and i conclude that there is 2 major problem that most of you are facing right now :
Problem #1 : The app cant open and keeps closing.
Problem #2 : The data folder can't be open.
Okay I'm not here to be a hero or so what.. I'm here just to share what I've learned.. I'm not good with this language and yeah me too also takes so much hard time to solve these problems.
Okay here's the solutions :
1. Repair the public void onCreate(SQLiteDatabase db) in DatabaseHelper.java class :
Here's the code :
public void onCreate(SQLiteDatabase db) {
String SQL_String = "CREATE TABLE " + TABLE_NAME + "(" + COL_1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COL_2 + " TEXT," + COL_3 + " TEXT," + CoL_4 +"INTEGER"+ ")";
db.execSQL(SQL_String);
}
Credits to +MickyM
2. Try to run the Android Studio in Administrator and if the device you're using to run the app is a real Android Device (not Virtual or Emulator) you must root your device first and if you're using an emulator you must run the "Android Device Monitor" in 23 API (or Lower APIs), APIs above 23 can cause problems when deploying Android Device Monitor. (I recommend the API 22 or the Lollipop version of Android OS).
You can see it here : stackoverflow.com/questions/34603355/android-device-monitor-data-folder-is-empty
Credits to +Scott Chow
i have same problems here
db.execSQL("create table" +TABLE_NAME+"(id INTEGER PRIMARY KeY AUTOINCREMENT, name TEXT,surname TEXT,marks INTEGER );
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS"+TABLE_NAME);
OnCreate(db);
hello Sir
after opening file explorer followed by data folder I am not able to open further folders after first data folder
please help
I did the TOOL > Android > Android Device Monitor then i didn't see my app name, help please Programming Knowledge
You need to have your emulator running with your app in order to see it show up in the ADM. Also, in order to view the individual files you should be running with an API of 23.
Run the application in emulator first, then you can go to the monitor,
My application keeps stopping automatically.. Any suggestions?
i too facing same issue.. if your problm solved.. kindly share it.
have you found something?
thanks for grt tutorials. How do i add date picker (DOB) column and radio buttons (Gender) column in Android SQLite database?
You can add more columns in the DatabaseHelper class
Thanks for your reply, it much appreciated, however i would like your help. I m creating a College Project which includes databases and im struggling on few things like adding Gender column. May i please send you my code and edit for me where and how radio buttons should go.
Literally just add another column in the DatabaseHelper class
My struggle is only on Add and Create method. Please post me an example. From here i will be alright Thanks.
0:00 add your extra column
3:56 include your extra column in create
when you add to your db, just include your extra column with everything else
what you're looking for is exactly what ProgrammingKnowledge is showing you step by step. if you're still confused, just watch the videos again
спасибо за видео! но включи субтитры, пожалуйста !
Thank you for the video! but turn on the subtitles, please
My File Explorer shows no files at all - any ideas on how to solve this issue even wen im using API 24
.Plz rply asap
Hi, I am trying to use it in fragment class. (not in main activity) and i am able to connect my fragment class to database class with this method that you just showed "myDB = new StudentsDatabase(this);"
what do i need to do in order to connect my database class to fragment class? anyone? any help?