Reputation: 6145
I am using the Android SQLiteDatabase in my application. Part of the application involves downloading a significant amount of data from a server and storing it on the phone's local db. Is there a way to find out how much space the database will actually take on the phone? I can't find any database-related files in the project folder.
Upvotes: 3
Views: 5614
Reputation: 3080
If you're using Eclipse do this:
You will see your database in this directory. If you want to pull the DB from your phone, use the buttons at the top of the File Explorer window, the first button pulls a file from your device, the second button allows you to put a file on your device and the last button deletes the selected file.
I often grab my DB from my app in this regard and do some "offline" testing in SQLite clients, it's very handy.
Hope that helps.
Upvotes: 1
Reputation: 1532
The local SQLite database stores in Environment.getDataDirectory()
+ /data/<Package Name>/databases
. Also you can call SQLiteDatabase$getPath() method.
SQLiteDatabase db;
// ...
long size = new File(db.getPath()).length();
Upvotes: 11