Reputation: 81
Hello please I need search in database in firebase all appearance with one parameter and write it on display or save in object. (if save in object I can process it)
My database looking
And i need get all match mDatabaseReference.child("horse").child(kon.getUid()).child("plemeno") with "Hnedy"
and save somewhere. or process write on display and search second.
I don't know why...
Thanks.
If I need run over all database for search or it's simply here.
Please give me all advice I select best for me.
If you need more info please write, but I don't know how you need.
..I would not know what to say
////////////////////////////////////////////////
for first I write on display all databse with thise code..
private void addEventFirebaseListener() {
//Progressing
circular_progress.setVisibility(View.VISIBLE);
list_data.setVisibility(View.INVISIBLE);
mDatabaseReference.child("horse").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(list_kone.size() > 0)
list_kone.clear();
for(DataSnapshot postSnapshot:dataSnapshot.getChildren()){
Kon kon = postSnapshot.getValue(Kon.class);
list_kone.add(kon);
}
ListViewAdapter adapter = new ListViewAdapter(All.this,list_kone);
list_data.setAdapter(adapter);
circular_progress.setVisibility(View.INVISIBLE);
list_data.setVisibility(View.VISIBLE);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
but I thing so it's no important for search
Upvotes: 0
Views: 1513
Reputation: 2135
Try this:
mDatabaseReference.child("horse").orderByChild("plemeno").equalTo("Hnedy").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// retrieve the data into an object: kon here
for(DataSnapshot postSnapshot : dataSnapshot.getChildren()){
Kon kon = postSnapshot.getValue(Kon.class);
if (cenaFilter && kon.getCena().equals("100")) {
// RETRIEVE DATA
}
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
Here cenaFilter
is a boolean which equals to true
if the user has selected this specific filter, false
otherwise
Upvotes: 2