When you open an SQLite database (using a class derived from
SQLiteOpenHelper) onCreate is called if the database does not exist.
You need to implement this method to create your database for the
first time.  Have a read of:

http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onCreate%28android.database.sqlite.SQLiteDatabase%29

--
RichardC

On Oct 26, 9:33 pm, Froens <[email protected]> wrote:
> Hi group
>
> I am new to developing programs to the  Android framework.
>
> I've read the sample exercises (http://developer.android.com/guide/
> tutorials/notepad/notepad-ex1.html) but have a question regarding
> their database creating.
>
> All database creation happens in the function ["onCreate()" -
> NotesDbAdapter.java ln 67].
>
> As I read the code, the create statement is run without checking that
> the DB exists.
> What if the db exists already? How ofthe is the function run? ... It
> doest override a method, but the class does not extend any class and
> thus does not inherint any functions to override?
>
> I've seen some work-arounds on the internet:
> To include a "IF NOT EXISTS"-statement in the SQL
> or
> Just check that the DB exists before querying it. If not, create it.
>
> Both seem very clumsy. Is there no way to setup a db at install time?
>
> Best regards and thanks in advance
> Frederik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to