转载:http://www.thinksaas.cn/group/topic/83748/
http://www.cnblogs.com/zhangs1986/p/3744756.html
http://blog.csdn.net/sgx425021234/article/details/9018387
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thundersoft.kids2/com.thundersoft.kids2.activity.MainActivity}: android.database.sqlite.sqliteException: near "tabletb_contacts": Syntax error (code 1):,while compiling: create tabletb_contacts(_idinteger primary key autoincrement,nametext not null,phonetext not null); 解决:sql 语句出错 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thundersoft.kids2/com.thundersoft.kids2.activity.MainActivity}: android.database.sqlite.sqliteException: near "tabletb_contacts": Syntax error (code 1):,phonetext not null); <pre name="code" class="java">解决:sql 语句出错java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thundersoft.kids2/com.thundersoft.kids2.activity.MainActivity}: java.lang.IllegalStateException: attempt to re-open an already-closed object: sqliteDatabase: /data/data/com.thundersoft.kids2/databases/contacts_database解决:再次使用数据库时,没有打开数据库
update 关键字里没有 and!!,new String[]{contact.getName(),contact.getPhone(),String.valueOf(contact.getId())});正确:mDatabase.execsql("update "+TABLE_NAME+" set name = ?,phone = ? where _id =?",String.valueOf(contact.getId())});
if(tmpList == null || tmpList.size() ==0){ Contact contactOne = new Contact("Zhangs","123456789"); Contact contactTwo = new Contact("Lis","456789123"); Contact contactThree = new Contact("Wangw","789456123"); simpleContactList = new ArrayList<Contact>(); simpleContactList.add(contactOne); simpleContactList.add(contactTwo); simpleContactList.add(contactThree); //插入 mDatabaseUtil.insertContactList(simpleContactList); //自动生成得ID 第一次没有读取到 simpleContactList = mDatabaseUtil.findAllContact();原文链接:https://www.f2er.com/sqlite/199000.html