私はそれを持っていCursor
ますSelect from sqlite
、これでquery
私はaをしますsubstring
が、それから使用するsubstring
ことはできませんが、エラーは発生しませんが、listView
空であると表示されます。
try {
String value = editText.getText().toString();
cursor = sql.rawQuery(
"SELECT MetaDataID,Data,CategoryID,ParentID FROM Book WHERE Data LIKE '"
+ "%" + value + "%'", null);
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
Struct_Search note = new Struct_Search();
note.MetaData = cursor.getInt(cursor.getColumnIndex("MetaDataID"));
Result = cursor.getString(cursor.getColumnIndex("Data"));
int A = Result.indexOf(value);
String V = Result.substring(A,100);
note.Value = V;
note.NumberAyeh = cursor.getInt(cursor.getColumnIndex("CategoryID"));
ParentID = cursor.getInt(cursor.getColumnIndex("ParentID"));
CursorSecond = sql.rawQuery("SELECT name FROM ContentList WHERE id ="+ ParentID, null);
if (CursorSecond != null) {
do {
CursorSecond.moveToFirst();
note.NameSureh = CursorSecond.getString(CursorSecond.getColumnIndex("name"));
CursorSecond.close();
} while (CursorSecond.moveToNext());
}
notes.add(note);
} while (cursor.moveToNext());
}
adapter.notifyDataSetChanged();
}
} catch (Exception e) {
} finally {
cursor.close();
}
注意: この行は機能しません:
String V = Result.substring(A,100);
note.Value = V;