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


Other Threads

1. How to handle imaged background and buttons on different size/proportion displays



I do not know what you are referring to here. Some bitmaps (e.g.,
nine-patch PNGs) are designed to be resized.


What is a "skinned view"?


In some cases, you will need multiple images for different screen sizes
or densities. In some cases, you can use nine-patch PNGs for resizing.
In some cases, Android's built-in bitmap scaling will be adequate. In
some cases, you will want to switch to creating Drawable resources in
XML (e.g., define your gradients that way, rather than doing so in a
bitmap).

Here is the documentation on multiple screen sizes:

http://developer.android.com/guide/practices/screens_support.html

Here are several blog posts on the subject:

http://www.androidguys.com/2010/02/16/handling-multiple-screen-sizes-part/
http://www.androidguys.com/2010/02/18/handling-multiple-screen-sizes-part-2/
http://www.androidguys.com/2010/02/23/handling-multiple-screen-sizes-part-3/
http://www.androidguys.com/2010/03/01/handling-multiple-screen-sizes-part-4/
http://www.androidguys.com/2010/03/02/handling-multiple-screen-sizes-part-5/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 

2. How to handle imaged background and buttons on different size/proportion displays

Hello,

Right now Im working on the UI of my first app and Id like it to
work on as many different devices as possible.
Ive read on the net about Androids rule not to resize bitmaps on
views (background, buttons, etc), is it true? Does android rescale
skinned views sizes the same way it resizes the default ones?
Also, if not, how can I handle the more than 5 display sizes using a
background image and skinned buttons and scrollers (horizontal bar)?

Thanks,
Gabriel

-- 

3. Modifying audio in real time

4. Passing Command line arguments

5. Adding new api to android

6. No Network Connectivity in Service/AlarmManager Process.

7. No Network Connectivity in Service/AlarmManager Process.