Last active
March 15, 2020 05:54
-
-
Save tareq3/bc072979c73fd5871e1e212818bb6c49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 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