samedi 5 septembre 2015

How can I create an instance of a class that extends SQLiteOpenHelper in Android Studio?

I need to create an instance of a class that extends SQLiteOpenHelper in Android Studio. I cannot create an empty constructor within the class that extends SQLiteOpenHelper, so how do I initialize the instance in my other class?

For example, I cannot just do this:

MyDatabaseManager myDatabaseManager = new MyDatabaseManager();

because the constructor of the MyDatabaseManager requires a context, name, factory, and version as perameters, but I also get an error when I try to create an empty construcor within the MyDatabaseManager class, because it extends SQLiteOpenHelper.

So how would I go about creating an instance of that class in another class?

Aucun commentaire:

Enregistrer un commentaire