0

I have a requirement, where I have to move data from text into SQLite DB on Android.

One way to do this was to move the text file to asset manager and from there I can insert data into the DB.

Is there any way through which I can insert all the data into the SQlite DB using Desktop app and then just ship the SQLite DB with the android app

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
Gainster
  • 5,481
  • 19
  • 61
  • 90

3 Answers3

1

This should help you.

Prepare the sqllite in desktop and then transfer it over to android

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

GSree
  • 2,890
  • 1
  • 23
  • 25
0

Have fun:

http://sqlitebrowser.sourceforge.net/index.html

Edit:

and then the solution is already on StackOverflow: Ship an application with a database

Community
  • 1
  • 1
Waza_Be
  • 39,407
  • 49
  • 186
  • 260
  • I should I put the DB into the resource folder and when i will open the file form android , how I know where to look for ? – Gainster Mar 16 '11 at 23:00
0

Depending on how much data needs to be input, you could also do it from within the application. E.g.

 void InsertDepts(SQLiteDatabase db)
     {
         ContentValues cv=new ContentValues();
            cv.put(colDeptID, 1);
            cv.put(colDeptName, "Sales");
            db.insert(deptTable, colDeptID, cv);
            cv.put(colDeptID, 2);
            cv.put(colDeptName, "IT");
            db.insert(deptTable, colDeptID, cv);
            cv.put(colDeptID, 3);
            cv.put(colDeptName, "HR");
            db.insert(deptTable, colDeptID, cv);
            db.insert(deptTable, colDeptID, cv);

     }
user319940
  • 3,267
  • 8
  • 38
  • 53