I want to know how to use A DB MANAGER (GUI tool) for built-in SQLite db in Android.I mean,I want to create,edit,delete,insert table/data by DB MANAGER rather than hard coding it, then I just want to read the data from DB. Can I export/import DB to/from android built-in DB. Why can/should I NOT use any independent,preloaded database in my application?
1 Answer
You can build your DB outside of the app and then load it in. No reason not to do so. You just need to make sure to set it up so that it meets certain requirements needed by Android. Those requirements would be:
Once the DB is set up you have a choice. Either put it in the assets folder of your app so it will be compiled into the app, or you can set up code to fetch it through some web service. In either case, it needs to end up in your apps data/databases directory so it can be used by the android system (if you want it kept private/unusable by other apps).
A good article covering what I've said above (as well as delving into code to copy the DB from your assets folder to the databases directory) can be found here.
Edit
You cannot put the DB directly into your apps data directory as its blocked from access by anything except your app (unless you root your device), so you must put it in your assets folder and then copy it from there to your apps data directory (or somewhere else that it can be used... it cannot be used from your apps assets).
The standard directory for DB storage is different for each app, there is no single directory for all of them. Android uses /data/data/your.package.name/databases/.
There are many ways to get the data from your DB... anything from copying it to a textfile and emailing it to wholesale copying the DB to/from your SD card where any other app can access it or you can with a DB manager.