SqLite Database connection
One of the first and more important information are: How to connect SQLite with Android app?
For this tutorial I am using Android Studio. You can download from official website.
First we need to create we database. I am using SQLite Manager (this is a plugin for Firefox).
I create a Data Base named "example" and a table named "exampleTable".
CREATE TABLE exampleTable ( name VARCHAR(200) NULL DEFAULT NULL, lastname VARCHAR(200) NULL DEFAULT NULL, ID VARCHAR(20) NULL DEFAULT NULL )
INSERT INTO exampleTable VALUES('Jhon', 'Sweet', '1');
INSERT INTO exampleTable VALUES('Audrey', 'Owen', '2');
INSERT INTO exampleTable VALUES('Michelle', 'Peters', '3');
INSERT INTO exampleTable VALUES('Helen', 'Black', '4');
INSERT INTO exampleTable VALUES('Jessica', 'Sweet', '5');
When the database are create, we need to put in the assent folder, in the Android Studio Proyect.
Then we create a Connection class.
In this class are two important lines in this class:
private static String DB_PATH = "/data/data/com.example.databaseconnect/databases/";
private static String DB_NAME = "example.sqlite";
One of the first and more important information are: How to connect SQLite with Android app?
For this tutorial I am using Android Studio. You can download from official website.
First we need to create we database. I am using SQLite Manager (this is a plugin for Firefox).
I create a Data Base named "example" and a table named "exampleTable".
CREATE TABLE exampleTable ( name VARCHAR(200) NULL DEFAULT NULL, lastname VARCHAR(200) NULL DEFAULT NULL, ID VARCHAR(20) NULL DEFAULT NULL )
INSERT INTO exampleTable VALUES('Jhon', 'Sweet', '1');
INSERT INTO exampleTable VALUES('Audrey', 'Owen', '2');
INSERT INTO exampleTable VALUES('Michelle', 'Peters', '3');
INSERT INTO exampleTable VALUES('Helen', 'Black', '4');
INSERT INTO exampleTable VALUES('Jessica', 'Sweet', '5');
When the database are create, we need to put in the assent folder, in the Android Studio Proyect.
Then we create a Connection class.
In this class are two important lines in this class:
private static String DB_PATH = "/data/data/com.example.databaseconnect/databases/";
private static String DB_NAME = "example.sqlite";