私のコードで間違いを見つけようとする人はいますか?私はすでに多くのことを試しましたが、いつも同じエラーで終わります。コードにこのようなエラーが発生するのはなぜですか? CursorIndexOutOfBoundsException
これは私のコードです:
String signeedep = spn.getSelectedItem().toString();
int a = spn1.getSelectedItemPosition();
Cursor userid = db.getallsigneenumber();
userid.moveToPosition(a);
Toast.makeText(getApplicationContext(),
userid.getString(1) + "//this is where the error points out
was assigned to the " + signeedep + ".",Toast.LENGTH_SHORT).show();
userid.close();
/*
db.open();
db.insertAssignsignee(signeedep, userid.getString(0));
db.close();
*/
myMethod();
これは私のエラーです:
FATAL EXCEPTION: main
android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1
getString(1)の呼び出しを正確にしたいのですか? – Canato
私はidであるカラム1の値を取得したいと思います。 – Justine
@Justineはあなたのテーブルに2つの列または単一の列を含んでいますか? – Munir