Introduction
 
 Xamarin is a platform to develop cross-platform and multi-platform apps (for  example, Windows phone, Android, iOS). In Xamarin platform, the code sharing concept is used. In Xamarin Studio,  Visual Studio is also available.
 
 Prerequisites
  	- Visual Studio 2015 Update 3.
The steps, given below, are required to be followed in order to insert data in  SQLite Data Base in the Xamarin Android app, using Visual Studio 2015.
 
 Step 1
 
 Click File--> select New--> select Project. The project needs to be clicked  after opening all the types of projects in Visual Studio, or click (Ctrl+Shift+N).
 
 ![Xamarin]()
 
 Step 2
 
 After opening the New Project, select Installed-->Templates-->Visual  C#-->Android-->choose the Blank app (Android).
 
 Now, give your Android app a name (Ex:sample) and give the path of your project.  Afterwards, click OK.
 
 ![Xamarin]()
 
 Step 3
 
 Next, go to the Solution Explorer and select Resource-->Layout-->double click to open main.axml page.
 
 ![Xamarin]()
 
 Step 4
 
 After opening, the main.axml file will open the main page designer. In this page,  choose which type you want so you can design this page.
 
 ![Xamarin]()
 
 Next, delete the default "hello world" button from the source panel by deleting  the button coding. Next, delete the C# button action code from MainActivity.cs page.
 
 Step 5
 
 In this step, add SQLite-net NuGet Package from Nuget Package Manager.
 
 Go to Solution Explorer-->Your Project-->Right Click-->Manage Nuget Packages.
 
 ![Xamarin]()
 
 Step 6
 
 Now Browse to search the SQLite Nuget Package. You need to select the SQLite-net  and click Install.
 
 ![Xamarin]()
 
 Step 7
 
 Now click ok to Install.
 
 ![Xamarin]()
 
 Step 8
 
 In this step, design your app. Now, go to the toolbox window.and scroll down. You will see all the  tools and controls.
 
 You need to drag and drop the Button.
 ![Xamarin]()
 
 Step 9
 
 Now, go to the Properties window. You need to edit the Button Id Value and Text  Value(EX:android:id="@+id/btninsert" android:text="INSERT").
 
 ![Xamarin]()
 
 Step 10
 
 In this step, go to the Main.axml page Source Panel. Note the Button Id Value.
 Main.axml
 
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:minWidth="25px" android:minHeight="25px">  
-     <Button android:text="INSERT" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btninsert" /> </LinearLayout>  
![Xamarin]() Step 11
 Step 11
  Add one layout called Insert.axml.
 Go to Solution Explorer-->Resource-->Layout-->Right click-->Add-->New  Item(Ctrl+Shift+A).  
![Xamarin]() Step 12
  Step 12
  Now, select Android Layout and give name (Insert.axml).  
![Xamarin]() Step 13
  Step 13
  Now, go to the toolbox window and drag and drop two Plain Text (EditText).  
![Xamarin]() Step 14
  Step 14
  You need to drag and drop the Button.  
![Xamarin]() Step 15
  Step 15
  Now, go to the Properties window. You need to edit the PlainText(EditText) Id  Value(EX:android:id="@+id/txtname").  
![Xamarin]() Step 16
  Step 16
  You need to edit the PlainText(EditText) Id Value(EX:android:id="@+id/txtemail").  
![Xamarin]() Step 17
  Step 17
  And also, edit the Button Id Value and Text Value (EX:android:id="@+id/btnsave"  android:text="STORE").  
![Xamarin]() Step 18
  Step 18
  In this step, go to the Main.axml page Source Panel. Note the Button Id Value  and EditText Id Values. 
 Insert.axml
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">  
-     <TextView android:text="Store Data" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/textView1" android:gravity="center" />  
-     <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtname" android:hint="NAME" />  
-     <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtemail" android:hint="[email protected]" />  
-     <Button android:text="STORE" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btnsave" /> </LinearLayout>  
![Xamarin]() Step 19
  Step 19
  In this step, create a Database Table called Persontable.cs. 
 Go to Solution Explorer-->Your app-->Right click-->Add-->New Item(Ctrl+Shift+A).  
![Xamarin]() Step 20
  Step 20
  Now, select the Class and give name Persontable.cs. and click add.  
![Xamarin]() Step 21
  Step 21
  Now, go to the Persontable.cs and write the following code to create the  Persontable.and add SQLite Namespace.
 Persontable.cs - using SQLite;  
- namespace XamarinSQLite {  
-     class Persontable {  
-         [PrimaryKey, AutoIncrement, Column("_Id")]  
-         public int id {  
-             get;  
-             set;  
-         }   
-         public string Name {  
-             get;  
-             set;  
-         }  
-         [MaxLength(30)]  
-         public string Email {  
-             get;  
-             set;  
-         }  
-     }  
- }  
![Xamarin]() Step 22
  Step 22
  In this step Create one Activity its name is called InsertActivity.cs. 
 Go to Solution Explorer-->Your app-->Right click-->Add-->New Item(Ctrl+Shift+A).  
![Xamarin]() Step 23
  Step 23
  Now, select the Activity and give name InsertActivity.cs. and click add.  
![Xamarin]() Step 24
  Step 24
  After this, add these two Namespaces.  
InsertActivity.cs
- using System.IO;  
- using SQLite;  
![Xamarin]() Step 25
  Step 25
  Now, write the following code from OnCreate() Method, and add three variables in  InsertActivity.cs page.  
InsertActivity.cs
 -   
- Button btncreate;  
- EditText txtname;  
- EditText txtemail;  
- protected override void OnCreate(Bundle savedInstanceState) {  
-     base.OnCreate(savedInstanceState);  
-     SetContentView(Resource.Layout.Insert);  
-     txtname = FindViewById < EditText > (Resource.Id.txtname);  
-     txtemail = FindViewById < EditText > (Resource.Id.txtemail);  
-     btncreate = FindViewById < Button > (Resource.Id.btnsave);  
-     btncreate.Click += Btncreate_Click;  
- }  
![Xamarin]() Step 26
  Step 26
  In this step create Btncreate_Click method and write the following code.  
InsertActivity.cs - private void Btncreate_Click(object sender, EventArgs e) {  
-     try {  
-         string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Person.db3");  
-         var db = new SQLiteConnection(dpPath);  
-         db.CreateTable < Persontable > ();  
-         Persontable tbl = new Persontable();  
-         tbl.Name = txtname.Text;  
-         tbl.Email = txtemail.Text;  
-         db.Insert(tbl);  
-         clear();  
-         Toast.MakeText(this, "Data Store Successfully...,", ToastLength.Short).Show();  
-     } catch (Exception ex) {  
-         Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show();  
-     }  
- }  
- void clear() {  
-     txtname.Text = "";  
-     txtemail.Text = "";  
- }  
![Xamarin]() Step 27
  Step 27
  In this step Go to the MainActivity.cs page and add two namespaces and add one  Variable.  
MainActivity.cs
  - using System.IO;  
- using SQLite;  
- Button btninsert;   
![Xamarin]() Step 28
  Step 28
  Now, Write the following code from MainActivity.cs page.  
MainActivity.cs - using System.IO;  
- using SQLite;  
- namespace XamarinSQLite {  
-     [Activity(Label = "XamarinSQLite", MainLauncher = true, Icon = "@drawable/icon")]  
-     public class MainActivity: Activity {  
-         Button btninsert;  
-         protected override void OnCreate(Bundle bundle) {  
-             base.OnCreate(bundle);  
-               
-             SetContentView(Resource.Layout.Main);  
-             btninsert = FindViewById < Button > (Resource.Id.btninsert);  
-             btninsert.Click += delegate {  
-                 StartActivity(typeof(InsertActivity));  
-             };  
-             CreateDB();  
-         }  
-         public string CreateDB() {  
-             var output = "";  
-             output += "Creating Databse if it doesnt exists";  
-             string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Person.db3");   
-             var db = new SQLiteConnection(dpPath);  
-             output += "\n Database Created....";  
-             return output;  
-         }  
-     }  
- }  
-   
- if ('this_is' == /an_example/) {  
-     of_beautifier();  
- } else {  
-     var a = b ? (c % d) : e[f];  
- }  
![Xamarin]() Step 29
  Step 29
  If you have an Android Virtual device, run the app on it. Else, connect your  Android phone and run the app in that. 
 Simply, connect your phone and go to Visual Studio. The connected phone will  show up in the Run menu (Ex:LENOVO A6020a40(Android 5.1-API 22)). Click the Run  option.  
![Xamarin]() Output
  Output
  After a few seconds, the app will start running on your phone. 
 You will see your app is running successfully. 
 Now click Insert Button.  
![Xamarin]() 
  Now, you can give the input.and click STORE button.  
![Xamarin]() 
  ![Xamarin]() 
  Now, you can see that your Data has been stored successfully.  
![Xamarin]() Summary
  Summary   So, this was the process of how to insert data in SQLite Database in Xamarin  Android app, using Visual Studio 2015.