Hello I wanted to ask you a question what happens is that I have data saved in firebase in the following way users that are my different users and within these users there is a score field that contains other data
What I would like is for the score data to appear in the list view I did in my activity with its corresponding user relice a code but every time I run it automatically closes my application I think it is a problem that does not recognize the user if someone could help me I would be grateful
I have a method to start firebase where I think the error is
private void inicializarFirebase() {
firebaseAuth =FirebaseAuth.getInstance();
if (firebaseAuth.getCurrentUser()== null){
finish();
startActivity(new Intent(this,ingreso.class));
}
FirebaseUser user=firebaseAuth.getCurrentUser();
FirebaseDatabase database = FirebaseDatabase.getInstance();
databaseReference = database.getReference("Users").child(user.getUid());
}
and this is the part of the list view
private void listarDatos() {
databaseReference.child("Score").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
listscore.clear();
for (DataSnapshot objetsnatshot : dataSnapshot.getChildren()){
Score s=objetsnatshot.getValue(Score.class);
listscore.add(s);
scoreArrayAdapter = new ArrayAdapter<Score>(resultados.this, android.R.layout.simple_list_item_1,listscore );
listvscore.setAdapter(scoreArrayAdapter);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
Thanks in advance