如何在sqlite database
a 中找到确切的数据并检索它listactivity
?我试过这样,但我没有得到价值。
search = (EditText) findViewById(R.id.alertsearch);
search.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
list2.clear();
db = openOrCreateDatabase(Contactsnew.DB_NAME, MODE_PRIVATE, null);
Cursor cTitle=db.rawQuery(" SELECT * FROM "+ Contactsnew.TABLE02 + " WHERE "
+ Contactsnew.userid + " = " + GetSet.getUserId() + " AND " + Contactsnew.TITLE +
" LIKE ? " ,new String []{search.getText()+"%"});
custAdapter.changeCursor(cTitle);
while(cTitle.moveToNext()){
list2.add(cTitle.getString(2));
}
cTitle.close();
}