SQLite Insert Record into Table

saving-records-in-sqlite-android-thumb

To start with this tutorial we you first need to complete this tutorial in which we have created a database and table.

SQLite Create Database and Tables

So let’s get started with this tutorial.

Step 1:

This time we will get into the MainActivity.java file

Let us inatialize all the EditText, Listview, Buttons from our view.

Step 2:

Now next add the code for insert button.

Step 3:

Next we need to add a method into our DBHandler file

Here’s the code, you need to add below the onUpgrade() method

Step 4: 

Final MainActivity.java file and DBHandler file will look like this

In the next tutorial we will see how to view the records in Listview

One thought on “SQLite Insert Record into Table

Leave a Reply

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