My ListView have more than 3000 rows. And when I typing on EditText to filter data in my ListView it run slowly. Look at my code here
final TextWatcher textChecker = 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) {
filterData(search.getText().toString());
}
};
private void filterData(String textinput){
mCursor = mHelperData.searchData(textinput);
startManagingCursor(mCursor);
String[] from = new String[]{ MyData.KEY_ROWID,
MyData.KEY_TITLE, MyData.KEY_DESCRIPTION };
int[] to = new int[]{ R.id.id, R.id.title, R.id.description, R.id.icon };
setListAdapter(new MyAdapter(this, R.layout.list_row, mCursor, from, to ));
}
I think retrieve data with Cursor is not a good way here. So, Is there any better way to improve the speech in this case?