I am new to Android. Now, I am trying to work with database. I got many tutorials for manipulating Sqlite database operations. But my doubt is that where should I add the .db file in to the application. In package explorer window of IDE, under which folder group I need to add the .db file? I hope you understand my question.
Thanks in advance.
You can add your database file in assets folder. you can add your db file in the assets folder. If it solution isn't true, should describe your problem.
To open the database inspector select View -> Tool Windows -> Database Inspector from the menu bar of Android Studio. Connect a device running on API level 26 or higher. Run the app. The database schemas appear and you can select the database you want to see.
There is no "standard place" for a sqlite database. The file's location is specified to the library, and may be in your home directory, in the invoking program's folder, or any other place.
If you already have .db file then put that file in assets folder or raw folder
Then you have to copy that file at path /your.package.name/data/data directory for further use.
Otherwise you can create new database using code...
see this example....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With