-3
A
回答
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("[email protected]::>", _key + " " + _value);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.e("[email protected]@@[email protected]@_GetAllcustProd:>", firebaseError + "");
}
});
+0
谢谢@Rjz,不准确,但我解决了我提到的这个问题:) –
+0
不客气。这是获取和存储的方式。这是暗示......就像那样:) –
你的问题是不是clear.Post的一些详细信息,请question.Probably你可以得到downvote – Noorul
阅读火力文档和尝试实施,而不是要求整个代码请。 –
你读过这个吗? https://firebase.google.com/docs/database/android/read-and-write – Vyacheslav