Personal greetings!
I'm developing an app for android and I have a problem still unsolved.
I have an editText that receives a user text to do a search in SQLite database as the user is typing the search is going on. But this is only working in the emulator, when I do the tests on a real device and with the android in a more recent version the search does not work as the user is typing, but only when he finishes typing and presses "ok" on the keyboard.
Below is the code for the search performed through editText:
final EditText editTextPesquisarCategoria = (EditText) findViewById(R.id.editTextPesquisarVisualizar);
editTextPesquisarCategoria.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
//Prencher o ListView
String[] busca = new String[]{"%" + editTextPesquisarCategoria.getText().toString() + "%"};
Cursor cursor = db.query("categorias", new String[]{"_id", "categoria"}, "categoria LIKE ?", busca, null, null, "_id ASC", null);
adt.changeCursor(cursor);
ListView listViewCategoriasMain = (ListView) findViewById(R.id.listViewMainVisualizar);
listViewCategoriasMain.setAdapter(adt);
return false;
}
});
Any help is welcome.
Hugs!