AndyAndroid
AndyAndroid

Reputation: 4069

SQLiteOpenHelper error

I read this http://developer.android.com/resources/tutorials/notepad/index.html and now try to create my own simple example. For simplification reasons I don't have my own Adapter Class. When I try this

SQLiteOpenHelper dbHelper = new SQLiteOpenHelper(this,"myDB.db3", null, 1);

in my applications onCreate method I see Ecplise telling me

Cannot instantiate the type SQLiteOpenHelper

I am not seeing what is basically different from the SDK tutorial (apart from that my call to the constructor is not wrapped in helper classes).

Thanks, A.

Upvotes: 5

Views: 1913

Answers (1)

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43098

SQLiteOpenHelper is an abstract class, you should inherit from it in order to instantiate one.

public class MyOpenHelper extends SQLiteOpenHelper {

...

}

MyOpenHelper dbHelper = new MyOpenHelper(...);

Upvotes: 5

Related Questions