SlideShare una empresa de Scribd logo
1 de 25
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
Make a demo project
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.
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.
Now back in our ContactListActivity
Output

Más contenido relacionado

La actualidad más candente

Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
Jakir Hossain
 
android sqlite
android sqliteandroid sqlite
android sqlite
Deepa Rani
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
Stanley Huang
 

La actualidad más candente (20)

Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
Sqlite
SqliteSqlite
Sqlite
 
Database in Android
Database in AndroidDatabase in Android
Database in Android
 
android sqlite
android sqliteandroid sqlite
android sqlite
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 
Android database tutorial
Android database tutorialAndroid database tutorial
Android database tutorial
 
Databases in Android Application
Databases in Android ApplicationDatabases in Android Application
Databases in Android Application
 
Android Database
Android DatabaseAndroid Database
Android Database
 
Android Database Tutorial
Android Database TutorialAndroid Database Tutorial
Android Database Tutorial
 
A brief introduction to SQLite PPT
A brief introduction to SQLite PPTA brief introduction to SQLite PPT
A brief introduction to SQLite PPT
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
 
SQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management SystemSQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management System
 
SQLite 3
SQLite 3SQLite 3
SQLite 3
 
09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)
 
SQLite3
SQLite3SQLite3
SQLite3
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 
Sq lite database
Sq lite databaseSq lite database
Sq lite database
 
Getting Started with SQLite
Getting Started with SQLiteGetting Started with SQLite
Getting Started with SQLite
 
ODI User and Security
ODI User and Security ODI User and Security
ODI User and Security
 

Similar a Database

Data virtualization
Data virtualizationData virtualization
Data virtualization
Hamed Hatami
 
How to Quickly and Easily Draw Value from Big Data Sources_Q3 symposia(Moa)
How to Quickly and Easily Draw Value  from Big Data Sources_Q3 symposia(Moa)How to Quickly and Easily Draw Value  from Big Data Sources_Q3 symposia(Moa)
How to Quickly and Easily Draw Value from Big Data Sources_Q3 symposia(Moa)
Moacyr Passador
 
IT Summit - Modernizing Enterprise Analytics: the IT Story
IT Summit - Modernizing Enterprise Analytics: the IT StoryIT Summit - Modernizing Enterprise Analytics: the IT Story
IT Summit - Modernizing Enterprise Analytics: the IT Story
Tableau Software
 

Similar a Database (20)

Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)
 
QuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing WebinarQuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing Webinar
 
Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)
 
Data Lake Overview
Data Lake OverviewData Lake Overview
Data Lake Overview
 
Data virtualization
Data virtualizationData virtualization
Data virtualization
 
Is the traditional data warehouse dead?
Is the traditional data warehouse dead?Is the traditional data warehouse dead?
Is the traditional data warehouse dead?
 
Big data architectures and the data lake
Big data architectures and the data lakeBig data architectures and the data lake
Big data architectures and the data lake
 
CRM UG Belux March 2017 - Power BI and Dynamics 365
CRM UG Belux March 2017 - Power BI and Dynamics 365CRM UG Belux March 2017 - Power BI and Dynamics 365
CRM UG Belux March 2017 - Power BI and Dynamics 365
 
Big SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopBig SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on Hadoop
 
Skillwise Big Data part 2
Skillwise Big Data part 2Skillwise Big Data part 2
Skillwise Big Data part 2
 
Skilwise Big data
Skilwise Big dataSkilwise Big data
Skilwise Big data
 
How to Quickly and Easily Draw Value from Big Data Sources_Q3 symposia(Moa)
How to Quickly and Easily Draw Value  from Big Data Sources_Q3 symposia(Moa)How to Quickly and Easily Draw Value  from Big Data Sources_Q3 symposia(Moa)
How to Quickly and Easily Draw Value from Big Data Sources_Q3 symposia(Moa)
 
Why a Data Services Marketplace is Critical for a Successful Data-Driven Ente...
Why a Data Services Marketplace is Critical for a Successful Data-Driven Ente...Why a Data Services Marketplace is Critical for a Successful Data-Driven Ente...
Why a Data Services Marketplace is Critical for a Successful Data-Driven Ente...
 
the Data World Distilled
the Data World Distilledthe Data World Distilled
the Data World Distilled
 
Modern Data Management for Federal Modernization
Modern Data Management for Federal ModernizationModern Data Management for Federal Modernization
Modern Data Management for Federal Modernization
 
Best Practices for Salesforce Data Access
Best Practices for Salesforce Data AccessBest Practices for Salesforce Data Access
Best Practices for Salesforce Data Access
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
 
Building Data Warehouse in SQL Server
Building Data Warehouse in SQL ServerBuilding Data Warehouse in SQL Server
Building Data Warehouse in SQL Server
 
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
 
IT Summit - Modernizing Enterprise Analytics: the IT Story
IT Summit - Modernizing Enterprise Analytics: the IT StoryIT Summit - Modernizing Enterprise Analytics: the IT Story
IT Summit - Modernizing Enterprise Analytics: the IT Story
 

Más de nationalmobileapps

Más de nationalmobileapps (17)

Fragment
Fragment Fragment
Fragment
 
Android Location Api
Android Location ApiAndroid Location Api
Android Location Api
 
Play Store
Play StorePlay Store
Play Store
 
GCM (push notification)
GCM (push notification)GCM (push notification)
GCM (push notification)
 
Android Sensor
Android SensorAndroid Sensor
Android Sensor
 
Ad Mob
Ad MobAd Mob
Ad Mob
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Google Map V2
Google Map V2Google Map V2
Google Map V2
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
 
Intent
IntentIntent
Intent
 
Support Multiple Screen
Support Multiple ScreenSupport Multiple Screen
Support Multiple Screen
 
Listview
ListviewListview
Listview
 
Android UI
Android UIAndroid UI
Android UI
 
Event Handling
Event HandlingEvent Handling
Event Handling
 
Project anatomy & hello world
Project anatomy & hello worldProject anatomy & hello world
Project anatomy & hello world
 
Mobile Application capacity building activities
Mobile Application capacity building activities Mobile Application capacity building activities
Mobile Application capacity building activities
 
Future of Smart phone in Bangladesh
Future of Smart phone in Bangladesh Future of Smart phone in Bangladesh
Future of Smart phone in Bangladesh
 

Último

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Último (20)

Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 

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
  • 6.
  • 7. Make a demo project
  • 8.
  • 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.
  • 21.
  • 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.
  • 23.
  • 24. Now back in our ContactListActivity