私はKEY_TOR == place.getTor()
CursorIndexOutOfBoundsException [SQLiteの]
行のための私のデータベースを検索したいここで私はメソッドを呼び出します。
DB_Place tor = db_tore.getDBPlace(place.getTor());
これはメソッドです:
public DB_Place getDBPlace(String name) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_DB_TORE_Eintrag, new String[] { KEY_ID,
KEY_PLACE_ID, KEY_NAME, KEY_LONGITUDE, KEY_LATITUDE, KEY_TOR }, KEY_TOR + "=?",
new String[]{name}, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
DB_Place place = new DB_Place(Integer.parseInt(cursor.getString(0)),
cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5));
return place;
}
このエラーが表示されている以外は、私にはうまく見えます。
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.x.x/com.example.ahok.x.UI_MainActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
私はここで何が欠けていますか? null
の列のいくつかと関係がありますか?
ところで、これその値が 'name'であることを既に知っているならば、' KEY_TOR'を検索する意味ですか? –
@Rotwangしました。それでも同じエラーです。 – Glave