事務(wù)操作必須放在try和catch中才有意義,不然很容易崩潰.
try {
db.beginTransaction();
// do db operation
db.setTransactionSuccessful();
} catch (error) {
} finally {
db.endTransaction();
}
try {
db.beginTransaction();
// do db operation
db.setTransactionSuccessful();
} catch (error) {
} finally {
db.endTransaction();
}
2017-03-12
CursorAdapter的newView方法,使用inflate創(chuàng)建View時(shí),最好傳入parent參數(shù).
LayoutInflater.from(context).inflate(R.layout.list_item, parent, false);
LayoutInflater.from(context).inflate(R.layout.list_item, parent, false);
2017-03-12
數(shù)據(jù)庫分頁操作步驟:
1、頁碼為1時(shí)在ListView中展示對應(yīng)的數(shù)據(jù)
2、當(dāng)ListView加載完本頁的數(shù)據(jù)后,分頁加載下一頁數(shù)據(jù)并展示
1、頁碼為1時(shí)在ListView中展示對應(yīng)的數(shù)據(jù)
2、當(dāng)ListView加載完本頁的數(shù)據(jù)后,分頁加載下一頁數(shù)據(jù)并展示
2017-03-12
selete * from TABLE_NAME limit ? , ?; 當(dāng)前頁碼第一條數(shù)據(jù)的下標(biāo),每頁顯示的數(shù)據(jù)
2017-03-12
最新回答 / 追尋01234
getReadDatabase和getWriteDataBase的實(shí)際效果是一樣的,都是打開可讀可寫的數(shù)據(jù)庫,但是使用getReadDataBase()時(shí),可能存在特殊情況,比如說磁盤滿了,但是你還想往數(shù)據(jù)庫插入東西這個語句就會失效
2017-03-07