0
でスピナーSQLiteの値を選択したときに、私はスピナーで値を選択して、私はのIDを取得し、私はSQLiteデータベース私は以前のAndroid
からの値を持つスピナーを持つダイアログのTextViewにデータを表示できません値
私はカスタムダイアログを開いて、私は私のSQLiteの値を検索し、これらの値を使用して、いくつかのTextViewsのテキストを設定するために、前のIDに基づいて、必要
if(selected_id!=null)
{
Cursor MyCursor = mHelper.getSelectedSeason(selected_id);
txtPickName.setText(MyCursor.getString(MyCursor.getColumnIndex("name")));
txtPickStart.setText(MyCursor.getString(MyCursor.getColumnIndex("start")));
txtPickEnd.setText(MyCursor.getString(MyCursor.getColumnIndex("end")));
}
しかし
私は壮大
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
私のクエリは次のようになってしまう。
public Cursor getSelectedSeason(int id)
{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery("select * from seasons where season_id=" + id + "", null);
return res;
}