I would not recommend putting the db on sdcard.
I went down that path and it worked well for all the devices I tested
it on (>15 hardware devices and of course emulators).
It even worked well for the published app in the beginning but because
the availability of the sdcard can be "shaky" at times especially on
some devices (I won't mention brands),
with increased downloads I got more and more reports of
SQLiteExceptions, SQLiteDatabaseCorruptException and
SQLiteDiskIOExceptions and there is nothing you can do about it
(sdcard is either there or not, db is either accessible or not).

Right now I got approximately 200 reports of that sort for an app with
>250K downloads. I finally decided to remove the db on sdcard feature
and since then haven't gotten any error reports of that sort.
But of course this decision depends also on the size of the database
(mine was >5 MB, today much smaller).

Cheers
Emanuel Moecklin

On Apr 7, 3:45 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Ok, here is my setup, just for grins.
>
> I have one database object in the entire application, opened by the
> content provider and never closed. The database is accessible as a
> singleton (my own SQLiteOpenHelper type class that can put the DB on the
> memory card).
>
> The UI uses the CP for the few queries that are shown "live" (in list
> views) so it can leverage the change notification mechanism built into
> the framework.
>
> For the all other database queries and updates, often made by non-UI
> threads, I directly use the same database object.
>
> The code that writes to the DB uses ContentResolver.notifyChange() to
> trigger updates to live lists in the UI, as necessary. Doing this rather
> than writing through the content provider gives me better control over
> when and how these notifications are sent. It also makes it easier to
> use transactions.
>
> -- Kostya
>
> 07.04.2011 23:26, lbendlin пишет:
>
> > I close the databases in the onDestroy() of the launcher activity. I
> > also include code in other activities and services to check if the
> > databases have been closed, and then prevent these lenient lurkers
> > from trying to access them.
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to