referenc2= FirebaseDatabase.getInstance().getReference("messageCounter").child("node");
referenc2.addValueEventListener(new ValueEventListener() {
public void onDataChange(@NonNull DataSnapshot snapshot) {
String count= Integer.parseInt(snapshot.child("cnt").getValue(String.class));
}
@Override public void onCancelled(@NonNull DatabaseError error) {
}
});
I need to retrieve the value stored inside the cnt node into a variable in android studio. can anyone help?