I am trying to get data from Firebase to bilgiler variable. But I get error all the time. How can I solve this?
Map<String, String> bilgiler = new HashMap<>();
db.collection("tarihBilgi")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : Objects.requireNonNull(task.getResult())) {
//Log.d("TAG", document.getId() + " => " + document.getData());
bilgiler.put("asdf", document.getData().toString());
}
} else {
Log.w("TAG", "Error getting documents.", task.getException());
}
}
});
Log.i("asdfads",(bilgiler.get("asdf")));