My question is two fold. I had been using RxSearchView for a while. I have used map, filter and finally switchMap to query the search events from api. First in the map or filter function, I have updated the ui like this:
.filter(new Predicate<String>() {
@Override
public boolean test(String s) throws Exception {
if (searchViewQueryTextEvent.queryText().toString().length() < 3 && mUserList != null) {
mUserList.clear();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mUserSearchAdapter.notifyDataSetChanged();
}
});
}
return s.length() > 2;
}
})
So is it a good practice to keep updating the ui from inside these functions ? Secondly, deleting characters couldn't be handled this way. Please give me suggestions/ links. I am new to Rx. Thanks very much!