このコードを使用していますが、null値が返されます。私は自分のコードをデバッグしていた場合、その与えられたNULL値を示しているリスト返り値null
List<TextJson> textList = null;
try{
textList = new ArrayList<TextJson>();
Cursor cursor = db.rawQuery("SELECT * FROM "+TABLE_TEXTS + " WHERE " + KEY_CATE + " = '" + text_spinner1 + " ' " , null);
Log.e("Cursor is","==>"+cursor);
Log.e("0_0", "0_0 1=>"); // code working on here
if(!cursor.isLast())
{
Log.e("Hey","last");
while (cursor.moveToNext())
{
TextJson txtlist = new TextJson();
txtlist.setId(cursor.getInt(0));
txtlist.setText_status(cursor.getString(1));
textList.add(txtlist);
}
}
db.close();
}catch (Exception e){
Log.e("error","is==> " +e);
}
return textList; // null value
マイログ
E/Spinner value is: --=> speech
E/inside: getDetailtospinner
E/Cursor is: ==>[email protected]
E/0_0: 0_0 1=>
E/Hey: last
はこのうち私を助けて。
には 'cursor.isLastを()'をチェックする必要がありますなぜですか? –
'while'の中に' Log'を入れて、 'cursor'がデータを返すかどうかを確認します。 – Venky
私のログを参照してください – newdeveloper