SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Android SQLite
Dr.T.Abirami
Associate Professor
Department of IT
Kongu Engineering College
abiananthmca@gmail.com
SQLite - Introduction
 open-source relational database
 i.e. used to perform database operations
on android devices
 such as storing, manipulating or retrieving
persistent data from the database.
T.ABIRAMI/KEC(Mobile application Development 2
SQLite - Introduction
 It is embedded in android by default.
 no need to perform any database setup or
administration task.
 Data is displayed in the logcat.
 For displaying data on the ListView OR
alert message.
 SQLiteOpenHelper class provides the
functionality to use the SQLite database.
T.ABIRAMI/KEC(Mobile application Development 3
Cursor class
 Retrieving data from SQLite databases in
Android is done using Cursors.
 The Android SQLite query method returns
a Cursor object containing the results of
the query.
 Cursors store query result records in rows
and grant many methods to access and
iterate through the records.
Methods
 moveToFirst() to position the Cursor
pointer at the first record
 moveToNext() function to iterate through
the records.
 isAfterLast() method performs a check to
see if the cursor is pointed after the last
record.
 When looping through records break the
loop when this becomes false.
 SQLiteDatabase
db=openOrCreateDatabase("con.db",
MODE_PRIVATE, null);
T.ABIRAMI/KEC(Mobile application Development 6
Create a database in SQLite
T.ABIRAMI/KEC(Mobile application Development 7
Create a Table
 db.execSQL("create table if not exists
tblcon(cname,cmob);");
T.ABIRAMI/KEC(Mobile application Development 8
Insert a data
 db.execSQL("insert into
tblcon(cname,cmob) " +
"values('"+strname+"','"+strmno+"');");
Reset data
 name.setText("");
 no.setText("");
T.ABIRAMI/KEC(Mobile application 9
View a one record at time
String strname=name.getText().toString();
Cursor cr=db.rawQuery
("select cmob from " +"tblcon where
cname='"+strname+"'", null);
if(cr!=null)
if(cr.moveToNext())
no.setText(cr.getString(cr.getColumnIndex
("cmob")));
Insert
String strname=name.getText().toString();
String
strmno=no.getText().toString();
db.execSQL("insert into
tblcon(cname,cmob) " +
"values('"+strname+"','"+strmno+"');");
name.setText("");no.setText("");
T.ABIRAMI/KEC(Mobile application 11
View
String strname=name.getText().toString();
Cursor cr=db.rawQuery("select cmob from " +
"tblcon where cname='"+strname+"'", null);
if(cr!=null)
if(cr.moveToNext())
no.setText(cr.getString(cr.getColumnIndex("c
mob")));
}
T.ABIRAMI/KEC(Mobile application 12
name=(EditText)findViewById(R.id.editText1);
no=(EditText)findViewById(R.id.editText2);
insert=(Button)findViewById(R.id.button1);
t1=(TextView)findViewById(R.id.textView1);
t2=(TextView)findViewById(R.id.textView2);
view=(Button)findViewById(R.id.button2);
db=openOrCreateDatabase("Info.db", MODE_PRIVATE, null);
db.execSQL("create table if not exists tblinfo(cname,cmob)");
insert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
String strname=name.getText().toString();
String strmno=no.getText().toString();
db.execSQL("insert into tblinfo(cname,cmob) " + "values('"+strname+"','"+strmno+"');");
name.setText("");
no.setText("");
} });
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
String strname=name.getText().toString();
Cursor cr=db.rawQuery("select cmob from " +"tblinfo where cname='"+strname+"'", null);
if(cr!=null)
if(cr.moveToNext())
no.setText(cr.getString(cr.getColumnIndex("cmob")));
}
});
T.ABIRAMI/KEC(Mobile application 13

More Related Content

Similar to Android SQLite database oriented application development (20)

PPTX
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
086ChintanPatel1
 
PPT
SQLITE Android
Sourabh Sahu
 
PDF
Android Level 2
DevMix
 
DOCX
Accessing data with android cursors
info_zybotech
 
DOCX
Accessing data with android cursors
info_zybotech
 
PPT
Sqlite
Kumar
 
PPTX
Contains the SQLite database management classes that an application would use...
GabrielPachasAlvarad
 
PPTX
Android Database
Dr Karthikeyan Periasamy
 
PPTX
Databases in Android Application
Mark Lester Navarro
 
PPTX
Create an android app for database creation using.pptx
vishal choudhary
 
PPTX
Data Handning with Sqlite for Android
Jakir Hossain
 
DOCX
Android database tutorial
info_zybotech
 
PPTX
Android Database
Rashad Aliyev
 
PPTX
Session 8 connect your universal application with database .. builders & deve...
Moatasim Magdy
 
DOCX
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Android App Development 05 : Saving Data
Anuchit Chalothorn
 
PDF
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
jillisacebi75827
 
PPTX
Android Database Tutorial
Perfect APK
 
PPT
Sq lite database
AYESHA JAVED
 
ODP
Session 2- day 3
Vivek Bhusal
 
Shshsjsjsjs-4 - Copdjsjjsjsjsjakakakaaky.pptx
086ChintanPatel1
 
SQLITE Android
Sourabh Sahu
 
Android Level 2
DevMix
 
Accessing data with android cursors
info_zybotech
 
Accessing data with android cursors
info_zybotech
 
Sqlite
Kumar
 
Contains the SQLite database management classes that an application would use...
GabrielPachasAlvarad
 
Android Database
Dr Karthikeyan Periasamy
 
Databases in Android Application
Mark Lester Navarro
 
Create an android app for database creation using.pptx
vishal choudhary
 
Data Handning with Sqlite for Android
Jakir Hossain
 
Android database tutorial
info_zybotech
 
Android Database
Rashad Aliyev
 
Session 8 connect your universal application with database .. builders & deve...
Moatasim Magdy
 
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Android App Development 05 : Saving Data
Anuchit Chalothorn
 
This is the official tutorial from Oracle.httpdocs.oracle.comj.pdf
jillisacebi75827
 
Android Database Tutorial
Perfect APK
 
Sq lite database
AYESHA JAVED
 
Session 2- day 3
Vivek Bhusal
 

More from Kongu Engineering College, Perundurai, Erode (20)

PPTX
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PPTX
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
PPT
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
PPTX
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
PPT
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
PPTX
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
PPTX
A REST API (also called a RESTful API or RESTful web API) is an application p...
Kongu Engineering College, Perundurai, Erode
 
PPTX
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
Bootstarp installation.pptx
Kongu Engineering College, Perundurai, Erode
 
PPTX
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Introduction to Generative AI refers to a subset of artificial intelligence
Kongu Engineering College, Perundurai, Erode
 
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database (MongoDB) using Node JS & Connect Node.js with NoSQ...
Kongu Engineering College, Perundurai, Erode
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
Node.js web-based Example :Run a local server in order to start using node.js...
Kongu Engineering College, Perundurai, Erode
 
Concepts of Satellite Communication and types and its applications
Kongu Engineering College, Perundurai, Erode
 
Concepts of Mobile Communication Wireless LANs, Bluetooth , HiperLAN
Kongu Engineering College, Perundurai, Erode
 
Web Technology Introduction framework.pptx
Kongu Engineering College, Perundurai, Erode
 
Computer Network - Unicast Routing Distance vector Link state vector
Kongu Engineering College, Perundurai, Erode
 
Android Application Development Programming
Kongu Engineering College, Perundurai, Erode
 
Introduction to Spring & Spring BootFramework
Kongu Engineering College, Perundurai, Erode
 
A REST API (also called a RESTful API or RESTful web API) is an application p...
Kongu Engineering College, Perundurai, Erode
 
SOA and Monolith Architecture - Micro Services.pptx
Kongu Engineering College, Perundurai, Erode
 
Connect to NoSQL Database using Node JS.pptx
Kongu Engineering College, Perundurai, Erode
 
nested_Object as Parameter & Recursion_Later_commamd.pptx
Kongu Engineering College, Perundurai, Erode
 
Ad

Recently uploaded (20)

DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
PPTX
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
Thermal runway and thermal stability.pptx
godow93766
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Ad

Android SQLite database oriented application development