How to create database in android using sqlite package

Saving data to a database is ideal for repeating or structured data, such as contact information. This class assumes that you are familiar with SQL databases in general and helps you get started with SQLite databases on Android. The APIs you'll need to use a database on Android are available in the android.database.sqlite package.

1. Create An Project With Empty Activity 

AndroidManifest.xml

click here to get code of androidmanifest.xml

This is the view of manifest file this file reamins unchanged in this application  

 

MainActivity.java

click here to get code of MainActivity.java

In this We can use the SQLiteDatabse For Create The Database Then We can execute query according to our requirements in this we can execute three queries of sql first is for create the database name "androidgts" and second is for to create the table name "tutorials" and last is for to insert values in the table

now here is the some snapshots of code u can check it and if u want to copy this code click on the link which is provided above by clicking on MainActivity.java


Activity_main.xml 

click here to get code of Activity_Main.xml

In This we can desing the xml layout for registeration form from which the data is entered by the user is stored in the database here is the some snapshots of the coding parts and the design parts u can check it and if u want to download the xml code of this layout u can download it by clicking on the link given above by clicking on Activity_Main.xml




Run Your Application 

I can use the genymotion emulator to run this application its is reliable and free for personal use  



Thanks For Reading this tutorial Keep update for more tutorials and if u have any problem Ask Freely in the comment session and in the ask questions tab

 


Komentar

Postingan Populer