【发布时间】:2021-08-17 06:39:35
【问题描述】:
我想从 firestore 检索数组映射并将其存储在一个数组中,但它似乎根本不起作用,关于如何解决它的任何想法?谢谢...
DocumentReference docRef = db.collection("user").document("65pH8UOnV4Pz8oxogsqsL9eE91L2");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
String[] array = (String[]) document.getData().get("card");
Log.d(TAG, "DocumentSnapshot data: "+ document.getData().get("card"));
} else {
Log.d(TAG, "No such document");
}
} else {
Log.d(TAG, "get failed with ", task.getException());
}
}
});
【问题讨论】:
标签: java arrays google-cloud-firestore