Prior to release 0.9 one could do the following to open or create a
SQLite database:

try {
  db = context.openDatabase(DATABASE_NAME, null);
} catch (FileNotFoundException e) {
  db = context.createDatabase(DATABASE_NAME, DATABASE_VERSION,
                                                Context.MODE_PRIVATE, null);
 createTables();
 insertSampleData();
}

So if the application can't open the database it creates a new one and
creates all tables and inserts test data.

Now both methods are gone and there is a single method
openOrCreateDatabase().

This method doesn't allow the programmer to distinguish between
opening an existing and creating a new database.
To decide if it should call createTables() and insertSampleData()
additional checks are necessary.

Can someone explain the background why this change was introduced? I
always prefer a clear contract of the API like different methods for
open(), close(), create(). Or did I miss something?
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to