cursor使用錯誤(android.database.CursorIndexOutOfBoundsException: Index -1 requested)

cursor使用錯誤(android.database.CursorIndexOutOfBoundsException: Index -1 requested)

在使用android.database.Cursor時調用getString(int)方法時報錯android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1

因爲cursor的遊標指向-1

解決方法:應該先調用cursor.moveToFirst();。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章