When i first click the button, the value of pass
variable is null
When i click it for the second time and change the value of edit1
, the pass
value is the value of the edit1
from the first click
Why is that?
This is my code
database = FirebaseDatabase.getInstance();
myRef = database.getReference("user").child(edit1.getText().toString()).child("password");
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
pass = dataSnapshot.getValue().toString();
}
@Override
public void onCancelled(DatabaseError error) {
}
});