Skip to content

Instantly share code, notes, and snippets.

@jerryOkafor
Last active November 12, 2016 15:15
Show Gist options
  • Save jerryOkafor/bec0e0644ce5c3f2dfeb24db9cfff9a3 to your computer and use it in GitHub Desktop.
Save jerryOkafor/bec0e0644ce5c3f2dfeb24db9cfff9a3 to your computer and use it in GitHub Desktop.
public void querySet(String memberId)
{
Query queryByMember = FirebaseDatabase.getInstance().getReference().child("sets").orderByChild("members/"+memberId).endAt(200);
queryByMember.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Not that we are returning a list as our query is on sets
//so iterate through the datasnapshot and get the values
for (DataSnapshot data : dataSnapshot.getChildren())
{
Set set = data.getValue(Set.class);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
//handle some errors here
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment