如题,我想检测表是不是有数据,代码如下:
if( cursor != null ){
cursor.moveToFirst();
if (cursor.getInt(0) == 0) {
Toast.makeText(getBaseContext(), "No records yet!", Toast.LENGTH_SHORT).show();
}
}
logcat如下:
CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
请指教,谢谢。