Skip to content

Instantly share code, notes, and snippets.

@tareq3
Last active March 15, 2020 05:54
Show Gist options
  • Select an option

  • Save tareq3/bc072979c73fd5871e1e212818bb6c49 to your computer and use it in GitHub Desktop.

Select an option

Save tareq3/bc072979c73fd5871e1e212818bb6c49 to your computer and use it in GitHub Desktop.
### Search Item from List:
#### Script:
```
private List<OutletItem> mOutletList;
Observable.fromIterable(mOutletList)
.filter((OutletItem item) -> {
return item.getNAME().toLowerCase().contains(String.valueOf(s).toLowerCase());
})
.toList()
.subscribe(new SingleObserver<List<OutletItem>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(List<OutletItem> outletItems) {
// Toast.makeText(OutletActivity.this, ""+ new Gson().toJson(outletItems), Toast.LENGTH_SHORT).show();
outletRecyclerViewAdapter = new OutletRecyclerViewAdapter(OutletActivity.this, OutletActivity.this, outletItems);
binding.rvOutlet.setAdapter(outletRecyclerViewAdapter);
}
@Override
public void onError(Throwable e) {
}
});
```
<img src="https://cdn.cacher.io/attachments/u/397rshf2ej0sc/oyHKBmWKfe-1wjv-2GctF9xZcHEjP7Yf/Rx-_Subjects.jpg">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment