android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
分析:如果表没有创建,执行操作:
cursor.moveToPosition(0)
后直接使用cursor,就会导致应用崩溃,显示如上错误:引用了容量为0的表的第一个元素。
应该对返回值作下判断:
if (cursor.moveToPosition(0) != true) {
Log.e(TAG, "moveToPosition return fails, maybe table not created!!!");
return null;
}