Intro To SQLite

SQLite is an opensource SQL database that stores data to a text file on any device. It supports all the relational database features and in order to access this database we don’t need to establish any kind of connections for it as android studio comes in with built in SQLite database implementation.


Creating A new Database

In this tutorial we will learn how to create an entire new database in android studio, how to insert data into it and  then lastly, how can we see all of our data that we have inserted so far on our screen. For this purpose, you need to create a new project in Android studio, select blank activity and hit finish.

First of all, we will create a new class named as “DataBase Helper” Class.



You can check this database at any time by opening android device monitor and select the package name of your app, next goto Data->data-> and then select the folder database from the name of your app, you will see this:




After adding any new data, you can open this file and can recheck it whenever you want. An extra tip is to open your Firefox browser and search for Sqlite manager in the Add ONS section. This feature will easily open the db file for you. Next we want to create an activity to add our data. Simply do the design part and then add the following code:







Build.gradle(Module app)

And then finally comes our Main Activity file. Here, i have added alert dialog, this will show our entire data added on the screen.


Now, you can successfully run your app and can create any innovative sqlite based android application by following the same technique. You can also download the code from here: SqliteApp




Leave a Reply

Your email address will not be published. Required fields are marked *