简体   繁体   中英

Android SQLite database into device

I'm developing an android application which contains 2 tables. I saw the table under DDMS tab. These two table contains some important data for my application(For example: username and password for 2000 records). But When I install my application on device, I couldn't able to see the table.

Also, In device when I'm running my application it creates a new table. This table contains no records. So when I check for username and password, it return no rows, affect my application.

So I need to copy the two tables into the device at the time of installing apk file. Is there any ways to do this?

You can fetching your database tables records using

SQLiteDatabase myDB = this.openOrCreateDatabase("test.sqlite",
          SQLiteDatabase.OPEN_READWRITE, null);
Cursor c = myDB.rawQuery("select a, b from abc", null); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM