Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Applications (Android Programming)

Similar presentations


Presentation on theme: "Mobile Applications (Android Programming)"— Presentation transcript:

1 Mobile Applications (Android Programming)
Semester II Dr. Saman Mirza Abdullah

2 Data in Mobiles Where are your data saved in your mobile?
How to manage them? How to retrieve them? How to update them? How all these process are going on inside the Android based mobiles? Mobile Application - Ishik

3 Class Objective The objective of this class is:
To explain the concept of databased in Android based application. To describe the classes and methods that work with the database package in Android. To describe the SQLite database in Android based applications. Mobile Application - Ishik

4 Database in Android To keep or save records in mobiles, Android provides a database service. Android applications support a type of database called SQLite. This types of database can be used also separately out of Android applications. It doesn't require any server, or ODBC or JDBC. Mobile Application - Ishik

5 SQLite It is an open source database.
It supports standard relational database features, such as in SQL statements. It requires limited memory at runtime (≅250 Kbytes). It supports the following datatypes: TEXT which is like sting in Java. INTEGER which is like long in Java. REAL which is like double in Java. Other types of data should be converted to one of these three types. Mobile Application - Ishik

6 SQLite It is available in all Android based devices, no need to installing the service. The only need is to define the SQL statements for creating and updating the databases. Accessing databases also need involving or defining filesystems. (simple tables) Mobile Application - Ishik

7 SQLite A created database in SQLite will be saved in the following directory path: DATA/data/Application_Name/database/FileName DATA/data; is the path director. Application name that you chose. File name of the database. Mobile Application - Ishik

8 SQLite Architecture 1. Packages
There are two packages supporting data manipulating inside the Android platform: android.database, that contains all necessary classes for working with databases. (content provider) android.database.sqlite, that specified for SQLite databases. Mobile Application - Ishik

9 SQLite Architecture 2. A super Subclass
To achieve database with SQLite, you need a super() subclass from the SQLiteOpenHelper class. It has two main parameters: Name of the database. Version of the database. A developer need to override to methods: onCreat() ; when the database crated for the first time. onUpgread () ; when changes in database needed. Mobile Application - Ishik

10 SQLite Architecture 2. A super Subclass
To Access SQLiteDatabase, two methods are used in the class SQLiteOpenHelper : getReadableDatabse() ; to access the database in the read only status. getWriteableDatabse() ; to access the database in the editable status besides the readable. One of these two methods should be clearly defined. Mobile Application - Ishik

11 Mobile Application - Ishik

12 SQLite Architecture 3. SQLite Database
SQLiteDatabase is the base class for working with a SQLite database in Android and provides methods to open, query, update and close the database. More specifically SQLiteDatabase provides the insert(), update(), and delete methods. It provides the execSQL() to execute SQL statements directly. Mobile Application - Ishik

13 Class End Mobile Application - Ishik

14 Quiz What is the main difference between these two database packages in SQLite android.databse. android.database.sqlite. Mobile Application - Ishik


Download ppt "Mobile Applications (Android Programming)"

Similar presentations


Ads by Google