I have a Firebase database structured as below
root
- users
-username1
-age : 30
-email_address : xxx@yyy.com
-user_connections
-username2: N
-username3: Y
-username4: N
-username2
-username3
-username4
So far I have queried ALL users and used the result as the datasource for my FirebaseListAdapter....HOWEVER if the current user is "username1", I only want the list to show username3 (as username1 has it's "user_connections" child showing username3 as Y).
I basically want to query a dataset of all records (users) where their "user_connections" child has a value of Y. Is this possible or do I need to restructure my database?
Any help would be much appreciated.....I am very new working with Android
Below is my code
databaseUser = FirebaseDatabase.getInstance().getReference("users");
//initialize list view
FirebaseListAdapter<User> fireAdapter = new FirebaseListAdapter<User>(
getActivity(),
User.class,
R.layout.listview_row_search,
databaseUser
) {
@Override
protected void populateView(View v, User model, int position) {