嘿,我想在我的应用程序中显示节点点的值 enter image description here
我尝试了这段代码,但是没有用
final TextView points_textview= findViewById(R.id.customerPoints_TextView);
String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
FirebaseDatabase firebaseDatabaseSeller = FirebaseDatabase.getInstance();
final DatabaseReference reference =firebaseDatabaseSeller.getReference().child("users").child("customers").child(userId);
reference.child("points").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
points_textview.setText(dataSnapshot.getValue(String.class));
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});