问答详情
源自:2-2 sqlite数据表查询(下)

sqlite moveTonext闪退

Caused by: NullPointerException:  android.database.Cursor.moveToNext()' on a null object reference

while (cursor.moveToNext()) {
 String id = cursor.getString(cursor.getColumnIndex(Constant._ID));
 Commodity commodity = new Commodity(id);
 list.add(commodity);
}

提问者:時差 2017-04-10 23:16

个回答

  • 何勇文
    2017-04-15 09:55:20

    空指针,cursor没初始化(cursor = ?)