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.
android.database.sqlite.SQLiteOpenHelper. A helper class to manage database creation and version management.
SQLiteOpenHelper provides callback methods and we should override it to get our job done. Those callback methods that we can override are onCreate(), onUpgrade(), onOpen() and onDowngrade(). And onCreate() and onUpgrade() are abstract methods and must be overridden.
SQLiteOpenHelper is a helper class to manage database creation and version management. In this class, the onUpgrade() method is responsible for upgrading the database when you make changes to the schema.
SQLiteOpenHelper class is used for database creation and version management. For performing any database operation, you have to provide the implementation of onCreate() and onUpgrade() methods of SQLiteOpenHelper class.
SQLiteOpenHelper is an abstract class, you should inherit from it in order to instantiate one.
public class MyOpenHelper extends SQLiteOpenHelper {
...
}
MyOpenHelper dbHelper = new MyOpenHelper(...);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With