The close() method is for closing the database. The open() method is where the database is created with the getWritableDatabase() method. This creates a new CardsDBHelper() object that will allow us to access the database. ![]() ![]() For the SampleSQLite application, we created a CardsDBHelper class that extends from SQLiteOpenHelper, and here’s the implementation that can be found in the CardsDBHelper.java file: public class CardsDBHelper extends SQLiteOpenHelper This is also where you create and upgrade your database. You need to create a Java class that extends from the SQLiteOpenHelper, and this is where you can define a database name and version, and where you define the tables and columns. Luckily, Android provides a helper class for defining a SQLite database table through Java code. The first thing that must be done is to define the database table that should be created for storing the cards in the database. ![]() Introduction to Android Application Development: Android Essentials, 5th Edition
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |