soufiane.dev Posted May 18, 2011 Share Posted May 18, 2011 Salut, je ve faire une list filtrable par un textedit mais ce code ça marche pas Cursor c2 = db.vaccinchild(); startManagingCursor(c2); final SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.vaccinlist, c2, new String[] { DBAdapter.doctor, DBAdapter.child_name, DBAdapter.date_received }, new int[] { R.id.txtvaccin, R.id.txtchild, R.id.txtdate }); setListAdapter(adapter); EditText txtFilter = (EditText) findViewById(R.id.txtsearch); txtFilter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s); } }); Link to comment Share on other sites More sharing options...
pat Posted May 18, 2011 Share Posted May 18, 2011 je crois que ce truc fonctionne sur un adapter de type ArrayAdapter<String> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.