SlideShare a Scribd company logo
Mobile Application
Development
Lecture 10
Database
Android SQLite Database
T. Yousef Alamir
SQLite is an open-source SQL database that stores data in a text file on a
device. Android comes in with built-in SQLite database implementation.
SQLite supports all the relational database features. In order to access
this database, you don’t need to establish any kind of connections for it
like JDBC, ODBC …etc.
Android - SQLite Database
Database – Package:
The main package is android.database.sqlite which contains the
classes to manage your own databases
Database – Creation:
In order to create a database you just need to call this method
openOrCreateDatabase with your database name and mode as a
parameter. It returns an instance of SQLite database which you
have to receive in your own object.Its syntax is given below
SQLite Database creation
SQLiteDatabase db = openOrCreateDatabase("database
name“ ,MODE_PRIVATE, null);
SQLiteDatabase Methods
Method name Description
1 openDatabase(String path,
SQLiteDatabase.CursorFactory
factory, int flags,
DatabaseErrorHandler
errorHandler)
This method only opens the existing database
with the appropriate flag mode. The common
flags mode could be OPEN_READWRITE
OPEN_READONLY
2 openDatabase(String path,
SQLiteDatabase.CursorFactory
factory, int flags)
It is similar to the above method as it also
opens the existing database but it does not
define any handler to handle the errors of
databases.
3 openOrCreateDatabase(String
path,
SQLiteDatabase.CursorFactory
factory)
It not only opens but creates the database if it
does not exist. This method is equivalent to the
openDatabase method.
4 openOrCreateDatabase(File file,
SQLiteDatabase.CursorFactory
This method is similar to the above method but
it takes the File object as a path rather than a
we can create a table or insert data into a table using execSQL method defined in
SQLiteDatabase class. Its syntax is given below:
Create users table:
db.execSQL(“
CREATE TABLE IF NOT EXISTS users(
Username VARCHAR,
Password VARCHAR
);“
);
Insert into users table:
db.execSQL("INSERT INTO users VALUES('admin','admin');");
This will insert some values into our table in our database. Another method that
also does the same job but take some additional parameter is given below
execSQL(String sql, Object[] bindArgs)
This method not only inserts data but is also used to update or modify already
existing data in the database using bind arguments
Database - Insertion
We can retrieve anything from the database using an object of the Cursor class. We will call a
method of this class called rawQuery and it will return a resultset with the cursor pointing to the
table. We can move the cursor forward and retrieve the data.
Retrieve data from users table:
Cursor resultSet = db.rawQuery("Select * from users",null);
resultSet.moveToFirst();
String username = resultSet.getString(0);
String password = resultSet.getString(1);
There are other functions available in the Cursor class that allows us to effectively retrieve the data.
That includes:
The the
Database - Fetching
Metod Description
1 getColumnCount() return the total number of columns of the table.
2 getColumnIndex(String
columnName)
returns the index number of a column by specifying the
name of the column
3 getColumnName(int
columnIndex)
returns the name of the column by specifying the index of
the column
4 getColumnNames() returns the array of all the column names of the table
5 getCount() returns the total number of rows in the cursor
6 getPosition() returns the current position of the cursor in the table
For managing all the operations related to the database, a helper
class has been given and is called SQLiteOpenHelper. It
automatically manages the creation and update of the database.
Its syntax is given below:
public class DBHelper extends SQLiteOpenHelper {
public DBHelper(){
super(context,DATABASE_NAME,null,1);
}
public void onCreate(SQLiteDatabase db) {}
public void onUpgrade(SQLiteDatabase database, int
oldVersion, int newVersion) {}
}
Database - Helper class
Thank You
T. Yousef Alamir 2023
http://Yousef.omairtech.com
Ad

More Related Content

Similar to Lecture 10: Android SQLite database.pptx (20)

Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...
TAISEEREISA
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
Dushyant Nasit
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
info_zybotech
 
Android sql examples
Android sql examplesAndroid sql examples
Android sql examples
Aravindharamanan S
 
Database in Android
Database in AndroidDatabase in Android
Database in Android
MaryadelMar85
 
4. Database Connectivity using JDBC .ppt
4. Database Connectivity using JDBC .ppt4. Database Connectivity using JDBC .ppt
4. Database Connectivity using JDBC .ppt
HITENKHEMANI
 
Java 1-contd
Java 1-contdJava 1-contd
Java 1-contd
Mukesh Tekwani
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptx
sridharu1981
 
Jdbc api
Jdbc apiJdbc api
Jdbc api
kamal kotecha
 
spring-tutorial
spring-tutorialspring-tutorial
spring-tutorial
Arjun Shanka
 
Chapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptxChapter 4 event it theory programming.pptx
Chapter 4 event it theory programming.pptx
kmkkali41
 
Java & banco de dados
Java & banco de dadosJava & banco de dados
Java & banco de dados
Fábio José da Silva
 
MAD UNIT 5 FINAL.pptx
MAD UNIT 5 FINAL.pptxMAD UNIT 5 FINAL.pptx
MAD UNIT 5 FINAL.pptx
Siva Krishna Prasad
 
Java jdbc
Java jdbcJava jdbc
Java jdbc
Arati Gadgil
 
Ado.net
Ado.netAdo.net
Ado.net
Iblesoft
 
Advance Java Practical file
Advance Java Practical fileAdvance Java Practical file
Advance Java Practical file
varun arora
 
Unit - IV (1).pptx
Unit - IV (1).pptxUnit - IV (1).pptx
Unit - IV (1).pptx
VaishnaviGaikwad67
 
Unit - IV.pptx
Unit - IV.pptxUnit - IV.pptx
Unit - IV.pptx
VaishnaviGaikwad67
 
Databases with SQLite3.pdf
Databases with SQLite3.pdfDatabases with SQLite3.pdf
Databases with SQLite3.pdf
Deepika,Assistant Professor,PES College of Engineering ,Mandya
 

More from Yousef Alamir (9)

Lecture 9: Menus and Additional Actions .pptx
Lecture 9: Menus and Additional Actions .pptxLecture 9: Menus and Additional Actions .pptx
Lecture 9: Menus and Additional Actions .pptx
Yousef Alamir
 
Lecture 8: Android Types of Storage.pptx
Lecture 8: Android Types of Storage.pptxLecture 8: Android Types of Storage.pptx
Lecture 8: Android Types of Storage.pptx
Yousef Alamir
 
Lecture 7: Android Kinds of Dialogs.pptx
Lecture 7: Android Kinds of Dialogs.pptxLecture 7: Android Kinds of Dialogs.pptx
Lecture 7: Android Kinds of Dialogs.pptx
Yousef Alamir
 
Lecture 6: Android Activity Life Cycle.pptx
Lecture 6: Android Activity Life Cycle.pptxLecture 6: Android Activity Life Cycle.pptx
Lecture 6: Android Activity Life Cycle.pptx
Yousef Alamir
 
Lecture 5: Android Routing using Intents.pptx
Lecture 5: Android Routing using Intents.pptxLecture 5: Android Routing using Intents.pptx
Lecture 5: Android Routing using Intents.pptx
Yousef Alamir
 
Lecture 4: Android All Kinds of Lists.pptx
Lecture 4: Android All Kinds of Lists.pptxLecture 4: Android All Kinds of Lists.pptx
Lecture 4: Android All Kinds of Lists.pptx
Yousef Alamir
 
Lecture 3: Android basic GUI widgets.pptx
Lecture 3: Android basic GUI widgets.pptxLecture 3: Android basic GUI widgets.pptx
Lecture 3: Android basic GUI widgets.pptx
Yousef Alamir
 
Lecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptxLecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptx
Yousef Alamir
 
Lecture 01: Introduction into Android.pptx
Lecture 01: Introduction into Android.pptxLecture 01: Introduction into Android.pptx
Lecture 01: Introduction into Android.pptx
Yousef Alamir
 
Lecture 9: Menus and Additional Actions .pptx
Lecture 9: Menus and Additional Actions .pptxLecture 9: Menus and Additional Actions .pptx
Lecture 9: Menus and Additional Actions .pptx
Yousef Alamir
 
Lecture 8: Android Types of Storage.pptx
Lecture 8: Android Types of Storage.pptxLecture 8: Android Types of Storage.pptx
Lecture 8: Android Types of Storage.pptx
Yousef Alamir
 
Lecture 7: Android Kinds of Dialogs.pptx
Lecture 7: Android Kinds of Dialogs.pptxLecture 7: Android Kinds of Dialogs.pptx
Lecture 7: Android Kinds of Dialogs.pptx
Yousef Alamir
 
Lecture 6: Android Activity Life Cycle.pptx
Lecture 6: Android Activity Life Cycle.pptxLecture 6: Android Activity Life Cycle.pptx
Lecture 6: Android Activity Life Cycle.pptx
Yousef Alamir
 
Lecture 5: Android Routing using Intents.pptx
Lecture 5: Android Routing using Intents.pptxLecture 5: Android Routing using Intents.pptx
Lecture 5: Android Routing using Intents.pptx
Yousef Alamir
 
Lecture 4: Android All Kinds of Lists.pptx
Lecture 4: Android All Kinds of Lists.pptxLecture 4: Android All Kinds of Lists.pptx
Lecture 4: Android All Kinds of Lists.pptx
Yousef Alamir
 
Lecture 3: Android basic GUI widgets.pptx
Lecture 3: Android basic GUI widgets.pptxLecture 3: Android basic GUI widgets.pptx
Lecture 3: Android basic GUI widgets.pptx
Yousef Alamir
 
Lecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptxLecture 02: Android Layouts.pptx
Lecture 02: Android Layouts.pptx
Yousef Alamir
 
Lecture 01: Introduction into Android.pptx
Lecture 01: Introduction into Android.pptxLecture 01: Introduction into Android.pptx
Lecture 01: Introduction into Android.pptx
Yousef Alamir
 
Ad

Recently uploaded (20)

Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Foundation Models for Time Series : A Survey
Foundation Models for Time Series : A SurveyFoundation Models for Time Series : A Survey
Foundation Models for Time Series : A Survey
jayanthkalyanam1
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
Imma Valls Bernaus
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025
fs4635986
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Foundation Models for Time Series : A Survey
Foundation Models for Time Series : A SurveyFoundation Models for Time Series : A Survey
Foundation Models for Time Series : A Survey
jayanthkalyanam1
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
Imma Valls Bernaus
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025
fs4635986
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Ad

Lecture 10: Android SQLite database.pptx

  • 2. SQLite is an open-source SQL database that stores data in a text file on a device. Android comes in with built-in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don’t need to establish any kind of connections for it like JDBC, ODBC …etc. Android - SQLite Database
  • 3. Database – Package: The main package is android.database.sqlite which contains the classes to manage your own databases Database – Creation: In order to create a database you just need to call this method openOrCreateDatabase with your database name and mode as a parameter. It returns an instance of SQLite database which you have to receive in your own object.Its syntax is given below SQLite Database creation SQLiteDatabase db = openOrCreateDatabase("database name“ ,MODE_PRIVATE, null);
  • 4. SQLiteDatabase Methods Method name Description 1 openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags, DatabaseErrorHandler errorHandler) This method only opens the existing database with the appropriate flag mode. The common flags mode could be OPEN_READWRITE OPEN_READONLY 2 openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags) It is similar to the above method as it also opens the existing database but it does not define any handler to handle the errors of databases. 3 openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory) It not only opens but creates the database if it does not exist. This method is equivalent to the openDatabase method. 4 openOrCreateDatabase(File file, SQLiteDatabase.CursorFactory This method is similar to the above method but it takes the File object as a path rather than a
  • 5. we can create a table or insert data into a table using execSQL method defined in SQLiteDatabase class. Its syntax is given below: Create users table: db.execSQL(“ CREATE TABLE IF NOT EXISTS users( Username VARCHAR, Password VARCHAR );“ ); Insert into users table: db.execSQL("INSERT INTO users VALUES('admin','admin');"); This will insert some values into our table in our database. Another method that also does the same job but take some additional parameter is given below execSQL(String sql, Object[] bindArgs) This method not only inserts data but is also used to update or modify already existing data in the database using bind arguments Database - Insertion
  • 6. We can retrieve anything from the database using an object of the Cursor class. We will call a method of this class called rawQuery and it will return a resultset with the cursor pointing to the table. We can move the cursor forward and retrieve the data. Retrieve data from users table: Cursor resultSet = db.rawQuery("Select * from users",null); resultSet.moveToFirst(); String username = resultSet.getString(0); String password = resultSet.getString(1); There are other functions available in the Cursor class that allows us to effectively retrieve the data. That includes: The the Database - Fetching Metod Description 1 getColumnCount() return the total number of columns of the table. 2 getColumnIndex(String columnName) returns the index number of a column by specifying the name of the column 3 getColumnName(int columnIndex) returns the name of the column by specifying the index of the column 4 getColumnNames() returns the array of all the column names of the table 5 getCount() returns the total number of rows in the cursor 6 getPosition() returns the current position of the cursor in the table
  • 7. For managing all the operations related to the database, a helper class has been given and is called SQLiteOpenHelper. It automatically manages the creation and update of the database. Its syntax is given below: public class DBHelper extends SQLiteOpenHelper { public DBHelper(){ super(context,DATABASE_NAME,null,1); } public void onCreate(SQLiteDatabase db) {} public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {} } Database - Helper class
  • 8. Thank You T. Yousef Alamir 2023 http://Yousef.omairtech.com