当我之前 select Android 中的 Spinner SQLite 值时,我无法将数据显示到对话框 textView

I cannot display data to a dialog textView when I previously select a spinner SQLite value in Android

我有一个微调器,其值来自 sqlite 数据库

我select微调器中的值,我得到值的id

我打开一个自定义对话框,我想根据之前的 ID 在我的 SQLite 中找到值,并使用这些值设置一些 TextView 的文本

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;
}

尝试将光标移动到最后一个位置,mycursor.MovetoLast