Skip to content
Advertisement

How to Filter Data in RxJava in Android

This is the Json data that i need to filter.

JavaScript

This my “ViewModel” Class

JavaScript

I want to filter the data that i’m getting from json. I only what to display all the data that contains “Bắn cá 2021” using the “game_name” attribute. The “getTips” function that i made have some error.

JavaScript

This is my first time to use rxjava in android.

Advertisement

Answer

You can see what is going on in your stream using doOnNext method or forEach or something similar:

JavaScript

Or you can change the comparison if you are expecting null gameName values:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement