Method to get the current size of the database

by Kalki » Thu, 23 Apr 2009 00:59:57 GMT


Sponsored Links
 Hi ,

I have created a database using the method openorCreateDatabase() and
set the maximum size of the database to 1MB using the method
setMaximumSize().

Now is there any methods available to check the current size of the
database.
Will an exception be thrown if the size exceeds 1MB.
--~--~---------~--~----~------------~-------~--~----~



Method to get the current size of the database

by Jeff Hamilton » Wed, 29 Apr 2009 00:51:58 GMT


 There isn't a method currently to return that, but you could do
something like this:

long getDbSize(SQLiteDatabase db) {
    return db.getPageSize() * DatabaseUtils.longForQuery(db, "PRAGMA
page_count;", null);
}

-Jeff




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links