Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Inserting large amount of data into android sqlite database?

1

48 views

I have a large amount of data i want to import into one sqlite database. 4column and 150 rows. Currently the data is in a excel spreadsheet.

How can i import it into my android application?

    String SQL = "create table " + TABLE + "( " 
        + BaseColumns._ID
        + " integer primary key, " 
        + Column1+ " text, "
        + Column2+ " text, "
        + Column3+ " text, " 
        + Column4+ " text);";
        db.execSQL(SQL);        

        ContentValues values = new ContentValues();
        values.put(DBAdapter.Column1,  "HP");
        values.put(DBAdapter.Column2,  "qw");
        values.put(DBAdapter.Column3,  "5280");
        values.put(DBAdapter.Column4,  "345, 546");
        db.insert(DBAdapter.TABLE, null, values);

        ContentValues values2 = new ContentValues();
        values2.put(DBAdapter.Column1,  "P");
        values2.put(DBAdapter.Column2,  "other");
        values2.put(DBAdapter.Column3,  "other");
        values2.put(DBAdapter.Column4,  "345");

} 

This is how i have inserted two rows into my DB, but i dont want to have to do this for 150?

asked June 24, 2011 4:07 am CDT
posted via StackOverflow

2 Answers

0
 

You could store the information on a CSV file, then read the file and store each row in sqlite.

answered June 24, 2011 4:25 am CDT
0
 

You can load database on your desktop using any of db console, add it to resources and replace db file created by DbHelper with your own file. If you use Motodev it will be much easier.

answered June 24, 2011 4:25 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions