


The following code shows how to create an SQLite database and a table in the database.Ĭopy Code public void onCreate(Bundle savedInstanceState)ĮditRollno=(EditText)findViewById(R.id.editRollno) ĮditName=(EditText)findViewById(R.id.editName) ĮditMarks=(EditText)findViewById(R.id.editMarks) ītnAdd=(Button)findViewById(R.id.btnAdd) ītnDelete=(Button)findViewById(R.id.btnDelete) ītnModify=(Button)findViewById(R.id.btnModify) ītnView=(Button)findViewById(R.id.btnView) ītnViewAll=(Button)findViewById(R.id.btnViewAll) ītnShowInfo=(Button)findViewById(R.id.btnShowInfo) ĭb=openOrCreateDatabase( " StudentDB", Context.MODE_PRIVATE, null) ĭb.execSQL( " CREATE TABLE IF NOT EXISTS student(rollno VARCHAR,name VARCHAR,marks VARCHAR) ") The SQLiteDatabase class from the package and the Cursor class from the android.database package provide all the functionality required for performing Data Manipulation Language (DML) and query operations on an SQLite table. For simplicity, I have created all fields of VARCHAR data type, which is a variable length character string.

The application accepts a student's roll number, name and marks and adds these details to a student table. The example application which I have created is a simple Student Management System, which allows a user to add, delete, modify and view student details. The example application shows how to perform basic DML and query operations on an SQLite table in Android. This article assumes that the user has a working knowledge of Android and basic SQL commands. Also most of the examples assume a deep knowledge of Android and SQL. Most of the articles and demos which I have seen on the net were not very simple for a layman to understand. In this article, I have attempted to demonstrate the use of SQLite database in Android in the simplest manner possible.
