Insert values into SQLite database manually

android, sqlite

Solution

Can I insert it in any other way like how we insert values in MySQL and Oracle databases? Hope that my problem is well understood.

Yes you can insert the data in SQLite database manually by following steps.

Steps to follow:

1) Go to your sdk-tool directory . (Example - E:\android-sdk-windows\tools>)
2) Type adb shell and press enter
3) cd data
4) cd data
5) cd your package name
6) cd databases

Once you reach here then do these steps to create database and create tables then insert data into it.

sqlite3 your_database_name.db;
SQLite version 3.7.7 2011-06-25 16:35:41

Enter ".help" for instructions Enter SQL statements terminated with a ";"

sqlite> CREATE TABLE province_table (pid INTEGER PRIMARY KEY AUTOINCREMENT, pname TEXT);
sqlite> INSERT INTO province_table (pname) values ('Quebec');
sqlite> ...
sqlite> .q

.q for quiet from SQLlite and now you have database `your_database_name.db`.

But here in your case if you want to create the database for all mobile such like that once your application run the start database manipulation then you must to do it programmatically.

Problem

I'm new to Android development and I've just started learning the basics of user-interface development. In my app, I have a spinner and I want to populate the spinner with values from the database. So, for taking values from the database, there have to be some values in it. How do I insert values to the database without writing a program? Can I insert it in any other way like how we insert values in MySQL and Oracle databases? Hope that my problem is well understood.

Original source

Related problems