I have a recordset of about 29,000 records. My Screen contains EditText Box for Search Criteria and Listview containing all 29,000 records.
By searching with the listed way it takes time and not giving flow less output as I need.
My EditText contains
final EditText txtSearchCity = (EditText) findViewById(R.id.edtCity);
txtSearchCity.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
aCountryIDTemp.clear();
aCityStateTemp.clear();
for (int i = 0; i < aCountryID.size(); i++) {
if (aCityState
.get(i)
.toLowerCase()
.contains(
txtSearchCity.getText().toString()
.toLowerCase())) {
aCountryIDTemp.add(aCountryID.get(i));
aCityStateTemp.add(aCityState.get(i));
}
}
BindList();
}
});
}
BindList() method is setting the arraylist aCityStateTemp to adapter. Any Other way to Search and Create new ArrayList dynamically.