开发者

SQLiteOpenHelper error

开发者 https://www.devze.com 2023-02-16 12:59 出处:网络
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 t

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开发者_如何学C not wrapped in helper classes).

Thanks, A.


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

public class MyOpenHelper extends SQLiteOpenHelper {

...

}

MyOpenHelper dbHelper = new MyOpenHelper(...);
0

精彩评论

暂无评论...
验证码 换一张
取 消