Filter Firebase data in Android

This article will show you how to filter Firebase data for an Android application. Firebase is a real time NOSQL database available from Google. Lots of the examples you see on the internet seem to feature firebase in a chat program. Since Firebase is real time, that makes perfect sense. You want messages showing up in real time in a chat program. But how does Firebase work with applications that sometimes need real time data, but most of the time don’t? You could develop an Android or web application that used multiple databases but that is a bit too much work. One of the main problems with Firebase is the lack of good search features. Firebase does include the ‘startAt’, ‘endAt’, ‘equalTo’ and other features, but it’s just not as powerful as using regular SQL. This is where client side filtering comes in. As of December 2016, the Firebase team doesn’t seem too keen on developing client side filtering as then too much data would be pulled from the servers. The best way to filter data is to do a combination of server side and client side filtering. Since there is plenty of information on server side filtering, this article will look at ways to filter Firebase data from an Android application.

To do client side filtering, I’ll use the following setup for an Android project:

1. Get a subset of your data sent to the Android application using some type of server side filtering.
2. Use a SearchView in your Android activity.
3. Create an abstract class that extends FirebaseListAdapter.
4. Implement a filter method in that abstract class.
5. Add or remove items from a List of your objects and display those to the user.

I’ve posted the entire project on Github at: It includes just about everything except for the strings.xml file which is where I store the API keys.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 − nine =