I have code like this:
public class DatabaseHelper extends SQLiteOpenHelper
{
private static final String DATABASE_NAME = "IDATT.data.db";
private static final int DATABASE_VERSION = 201;
private Context mContext;
public DatabaseHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
}
I wonder if onCreate/onUpgrade going to be called in super or after creation? Reason I ask – I need Context inside my onUpgrade/onCreate methods and don’t know how to test this class
The onCreate() is always called when you instantiate you class, just like those ones that extends Activity.
The onUpgrade() just gonna to be called if you pass a different DATABASE_VERSION to the super call.
Hope it helps