I need your help. I have a listview and search edittext, when I type to search for a record and matches from db, it displays all records. However, if no record matches it just displays nothing. What I wanna do is to display a message No Records Found
This is what I've tried so far:
etSearch.addTextChangedListener(new TextWatcher (){
public void afterTextChanged(Editable arg0) {
}
public void beforeTextChanged(CharSequence arg0, int arg1,
int arg2, int arg3) {
}
public void onTextChanged(CharSequence cs, int arg1, int arg2,
int arg3) {
adapter.getFilter().filter(cs.toString());
}
});
adapter.setFilterQueryProvider(new FilterQueryProvider() {
@Override
public Cursor runQuery(CharSequence constraint) {
String searchBy = constraint.toString();
if(cursor == null) {
Log.e("Cursor", "" + "Empty result");
}
return dbHelper.searchProduct(searchBy, telco);
}
});
Any ideas? I would gladly appreciate your help. Thanks.
Aucun commentaire:
Enregistrer un commentaire