答案 0 :(得分:1)
Firebase.setAndroidContext(this);
Firebase ref = new Firebase(YOUR_FIREBASE_URL);
ArrayList custProd= new ArrayList<>();
ref.child("customerrequest/-Ke8u4..../custProd/")
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
try {
if (dataSnapshot.getValue() != null) {
Map<String, String> value = (Map<String, String>) dataSnapshot.getValue();
for (Map.Entry<String, String> entry : value.entrySet())
{
String _key = entry.getKey();
String _value = entry.getValue();
// TODO add value in list
if (_value.length() > 0 && !custProd.contains(_value))
custProd.add(_value);
Log.e("!__@::>", _key + " " + _value);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.e("!_@@@_@@_GetAllcustProd:>", firebaseError + "");
}
});