Reputation: 574
I have found numerous web references on how to use a SQLite database.
But everything I have found has the DatabaseHelper - onCreate() routine creating a Data Table.
I want to create an Empty SQLite Database (No Tables) and then add tables later on an as-need basis.
Your advice/suggestions would be greatly appreciated.
Thanks
Upvotes: 0
Views: 46
Reputation: 5892
What you suggest is doable, but I don't get the point of not initialising your database with the default system.
In any case, keep in mind:
onCreate
method is not called until you don't get an instance of SQLiteDatabase
from your SQLiteOpenHelper
.SQLiteDatabase#exeSQL
So to your question:
Is it REQUIRED that 1 data table be added in order to Create a Database
No, your database will be created the first time you get a reference to a SQLiteDatabase, for example calling to getWritableDatabase
.
When I have tried to utilize the openOrCreateDatabase() function in my DatabaseHelper class, it comes up as un-resolved.
This method is more for internal use from the context. Use the open helper which is the preferred and recommended method.
Upvotes: 0
Reputation: 1006594
Is it REQUIRED that 1 data table be added in order to Create a Database?
You should be able to have a SQLiteOpenHelper
that does nothing in onCreate()
.
Or, use openOrCreateDatabase()
on SQLiteDatabase
.
When I have tried to utilize the openOrCreateDatabase() function in my DatabaseHelper class, it comes up as un-resolved.
That is a static method on SQLiteDatabase
, not SQLiteOpenHelper
.
Upvotes: 1