I'm using the SQLite DB on Android and I got that issue... I already put the permission "WRITE_EXTERNAL_STORAGE" and idk wtf I have to do! Plz, help me D:
Heres my code:
public static ArrayList<Livro> getLivrosWhere(String where) {
SQLiteDatabase db = SystemDB.instance.open().db;
Cursor cursor = db.query(TABLE_NAME, TABLE_FIELDS, where, null, null, null, "Ordem ASC");
ArrayList<Livro> retorno = new ArrayList<Livro>();
while (cursor.moveToNext()) {
Livro livro = new Livro();
livro.config(cursor);
retorno.add(livro);
}
if (cursor.isLast())
cursor.close();
db.close();
return retorno;
}
Broke when cursor.moveToNext()...
你应该用
SQLiteDatabase db = context.openOrCreateDatabase("sample.db", MODE_PRIVATE, 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.