SlideShare a Scribd company logo
Android 
SQLite Database
WHY DATABASES ON ANDROID? 
Common usage for a database 
• Huge amounts of data 
• Convenient query language to obtain data 
• Accessed/modified by huge amount of users 
Applications: 
• backend for multi-tier web architecture, 
• backend for business process architectures like SAP 
• areas: banks, insurance companies, ... 
Android 
• Small scale architecture, little data, few applications ...
What is SQLite? 
• SQLite is Open Source Database embedded into 
Mobile Devices. 
• SQLite supports SQL syntax, transactions and 
prepared statements. 
• SQLite consumes low memory approx. 250Kbyte.
SQLite 
• Relational database with tables (DB schema) 
• Popular embedded database, here: integrated in Android 
• SQL interface + small memory footprint + decent speed 
• Native API not JDBC 
• Properties (from http://www.sqlite.org/different.html) 
• Zero configuration and serverless 
• Single database file & stable across platforms 
• Compact, public domain, readable source code 
• Manifest typing and variable length records
SQLite vs Content Provider 
• SQLite 
• Persistent storage of data 
• Data accessible to a single application (the owner) 
• Often wrapped by a Content Provider 
• Content Provider 
• Specialized type of data store to share data across apps 
• Exposes standardized ways to retrieve/manipulate data 
• Query with URI: <standard_prefix>://<authority>/<data_path>/<id> 
• Examples: content://browser/bookmarks, content://contacts/people 
• Built in
Database
Make a demo project
Database
Create Database 
Add that CREATE_TABLE_SQL into onCreate Method
Database Open/Close
Database Insert()
Now in Main Activity
Add Button Click
Output
Now Get Data From Database
Add a Layout to Show Data in List
Add another Layout for List Row 
listrow.xml
Add New ContactListActivity
Add Button Click On MainActivity 
Add another button name Show All Contact 
in our activity_main.xml with id:btnAllContact
Add getContacts() in DatabaseAdapter Class 
This method will return data from database in a 
Arraylist.
Database
Make a Custom Adepter 
As you have done before in ListView 
Session 
Create a CustomAdapter to bind data in 
list adapter. 
Then set the adapter in our listview.
Database
Now back in our ContactListActivity
Output

More Related Content

PPTX
Using sqlite database in android with sqlite manager browser add ons
PPTX
SQLite database in android
PPT
Sqlite
PDF
Introduction to SQLite: The Most Popular Database in the World
PPTX
Android Training (Storing data using SQLite)
PDF
Persitance Data with sqlite
PPTX
SQLite - Overview
PDF
SQLite Database Tutorial In Android
Using sqlite database in android with sqlite manager browser add ons
SQLite database in android
Sqlite
Introduction to SQLite: The Most Popular Database in the World
Android Training (Storing data using SQLite)
Persitance Data with sqlite
SQLite - Overview
SQLite Database Tutorial In Android

What's hot (20)

PPTX
Data Handning with Sqlite for Android
PPTX
Sqlite
PPTX
Database in Android
PPTX
android sqlite
PPT
SQLITE Android
DOCX
Android database tutorial
PPTX
Databases in Android Application
PPTX
Android Database
PPTX
Android Database Tutorial
PPTX
A brief introduction to SQLite PPT
ODP
Introduction4 SQLite
DOCX
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
PPTX
SQLite: Light, Open Source Relational Database Management System
PDF
SQLite 3
PPTX
09.1. Android - Local Database (Sqlite)
PDF
SQLite3
PDF
Advanced Core Data
PPT
Sq lite database
PDF
Getting Started with SQLite
DOCX
ODI User and Security
Data Handning with Sqlite for Android
Sqlite
Database in Android
android sqlite
SQLITE Android
Android database tutorial
Databases in Android Application
Android Database
Android Database Tutorial
A brief introduction to SQLite PPT
Introduction4 SQLite
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
SQLite: Light, Open Source Relational Database Management System
SQLite 3
09.1. Android - Local Database (Sqlite)
SQLite3
Advanced Core Data
Sq lite database
Getting Started with SQLite
ODI User and Security
Ad

Similar to Database (20)

PPTX
Android webinar class_6
PPTX
Android Database
PPTX
Android session 4-behestee
DOCX
Android sq lite-chapter 22
PPTX
Mobile application Development-UNIT-V (1).pptx
PDF
Sql data base
PDF
Android development beyond the basics
PDF
Android Data Persistence
PDF
Android Level 2
PDF
Persistence in Android
PDF
Mobile Application Development -Lecture 11 & 12.pdf
PPT
Persistences
PDF
Android App Development 05 : Saving Data
PPTX
12_Data_Storage_Part_2.pptx
ODP
Android training day 4
PPTX
Contains the SQLite database management classes that an application would use...
PDF
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
PPTX
Android - Day 2
PPTX
Lecture 10: Android SQLite database.pptx
PPTX
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Android webinar class_6
Android Database
Android session 4-behestee
Android sq lite-chapter 22
Mobile application Development-UNIT-V (1).pptx
Sql data base
Android development beyond the basics
Android Data Persistence
Android Level 2
Persistence in Android
Mobile Application Development -Lecture 11 & 12.pdf
Persistences
Android App Development 05 : Saving Data
12_Data_Storage_Part_2.pptx
Android training day 4
Contains the SQLite database management classes that an application would use...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Android - Day 2
Lecture 10: Android SQLite database.pptx
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
Ad

More from nationalmobileapps (17)

PPTX
PPTX
Android Location Api
PPTX
Play Store
PPT
GCM (push notification)
PPTX
Android Sensor
PPTX
PPTX
Broadcast Receiver
PPTX
Google Map V2
PPTX
Activity & Shared Preference
PPTX
PPTX
Support Multiple Screen
PPT
PPTX
Android UI
PPTX
Event Handling
PPTX
Project anatomy & hello world
PPTX
Mobile Application capacity building activities
PPTX
Future of Smart phone in Bangladesh
Android Location Api
Play Store
GCM (push notification)
Android Sensor
Broadcast Receiver
Google Map V2
Activity & Shared Preference
Support Multiple Screen
Android UI
Event Handling
Project anatomy & hello world
Mobile Application capacity building activities
Future of Smart phone in Bangladesh

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Lesson notes of climatology university.
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Cell Types and Its function , kingdom of life
PDF
Insiders guide to clinical Medicine.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
master seminar digital applications in india
Supply Chain Operations Speaking Notes -ICLT Program
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Sports Quiz easy sports quiz sports quiz
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Lesson notes of climatology university.
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharma ospi slides which help in ospi learning
Final Presentation General Medicine 03-08-2024.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Anesthesia in Laparoscopic Surgery in India
Cell Types and Its function , kingdom of life
Insiders guide to clinical Medicine.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
master seminar digital applications in india

Database

  • 2. WHY DATABASES ON ANDROID? Common usage for a database • Huge amounts of data • Convenient query language to obtain data • Accessed/modified by huge amount of users Applications: • backend for multi-tier web architecture, • backend for business process architectures like SAP • areas: banks, insurance companies, ... Android • Small scale architecture, little data, few applications ...
  • 3. What is SQLite? • SQLite is Open Source Database embedded into Mobile Devices. • SQLite supports SQL syntax, transactions and prepared statements. • SQLite consumes low memory approx. 250Kbyte.
  • 4. SQLite • Relational database with tables (DB schema) • Popular embedded database, here: integrated in Android • SQL interface + small memory footprint + decent speed • Native API not JDBC • Properties (from http://www.sqlite.org/different.html) • Zero configuration and serverless • Single database file & stable across platforms • Compact, public domain, readable source code • Manifest typing and variable length records
  • 5. SQLite vs Content Provider • SQLite • Persistent storage of data • Data accessible to a single application (the owner) • Often wrapped by a Content Provider • Content Provider • Specialized type of data store to share data across apps • Exposes standardized ways to retrieve/manipulate data • Query with URI: <standard_prefix>://<authority>/<data_path>/<id> • Examples: content://browser/bookmarks, content://contacts/people • Built in
  • 7. Make a demo project
  • 9. Create Database Add that CREATE_TABLE_SQL into onCreate Method
  • 12. Now in Main Activity
  • 15. Now Get Data From Database
  • 16. Add a Layout to Show Data in List
  • 17. Add another Layout for List Row listrow.xml
  • 19. Add Button Click On MainActivity Add another button name Show All Contact in our activity_main.xml with id:btnAllContact
  • 20. Add getContacts() in DatabaseAdapter Class This method will return data from database in a Arraylist.
  • 22. Make a Custom Adepter As you have done before in ListView Session Create a CustomAdapter to bind data in list adapter. Then set the adapter in our listview.
  • 24. Now back in our ContactListActivity