下面的插入數據庫有什麼問題,調試時不報錯,直接在注釋的那行跳出方法了,為什麼會這樣
private void readContacts() {
Cursor cursor = null;
try {
cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null, null, null, null);
while (cursor.moveToNext()) {
String displayname = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone
.DISPLAY_NAME));
String number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone
.NUMBER));
SQLiteDatabase db=dbhelper.getWritableDatabase();//在這行自動跳過了
ContentValues values = new ContentValues();
values.put("name",displayname);
values.put("number",number);
values.put("imgid",R.mipmap.fruit1);
db.insert("Contacts",null,values);
自己本地的sqlite,dbhelper有沒有進行初始化