Mobile Applications (Android Programming) Semester II 2016 - 2017 Dr. Saman Mirza Abdullah
Class Objective The objective of this class is: To explain the concept of database in Android based application. To describe the classes and methods that work with the database package in Android. To describe the SQLite in Android applications. Mobile Application - Ishik
SQLite Database Open a new project. Create a subclass from the SQLiteOpenHelper class. It has the same process of the creating a class. Chose name “DatabaseHelper” Change the extends of the subclass to SQLiteOpenHelper. Add the following: Import the necessary library. Add necessary methods. Mobile Application - Ishik
Crating the super subclass Step 1 Crating the super subclass Step 2 Do extends Mobile Application - Ishik
Press OK Mobile Application - Ishik
Still there is red line. Mobile Application - Ishik
We need to build a default constructor Mobile Application - Ishik
Mobile Application - Ishik
Creating Database In general, for any database you should have: Database name Table name Column name. Student.db (database) Student (Table) ID NAME SURNAME MARKS 1 AAA A1 87 2 BBB B1 88 3 CCC C1 90 4 DDD D1 77 Mobile Application - Ishik
Adding Database Variables Mobile Application - Ishik
onCreate() and onUpgrade() Mobile Application - Ishik
Main Activity Code Mobile Application - Ishik
Class End Mobile Application - Ishik