We create a new database using the helper, but according to the document create must be called right after the database is created, but it is incorrectly called. can any plz help me solve this problem. Plz see the code below.
1) Is there a way to create a database instead of using an assistant, if so, plz advise me! 2) What calls will be made in creating the database, as well as when destroying the database?
OpenHelper(Context context)
{
super(context, "examplee.db", null, 1 );
SQLiteDatabase sqlite = null;
Log.w(TAG, "Openhelp database, ");
sqlite = context.openOrCreateDatabase("examplee.db", Context.MODE_PRIVATE, null );
Log.e ( TAG,"SQ lite database object "+sqlite );
}
public void onOpen(SQLiteDatabase db)
{
Log.e ( TAG,"On open called ");
}
@Override
public void onCreate(SQLiteDatabase db)
{
Log.w(TAG, " On create ");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
Log.w(TAG, "Upgrading database, this will drop tables and recreate.");
}
}
Thanks in advance,
source
share