I can get data from Firebird DataBase but they are updated only if I restart the activity how to do it without restarting the activity.
The code snippet with the implementation of retrieving data
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
long coinsAmount = dataSnapshot.child("coinsAmount").getValue(Long.class);
text.setText(String.valueOf(coinsAmount));
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d(TAG, databaseError.getMessage()); //Don't ignore errors!
}
};
uidRef.addListenerForSingleValueEvent(valueEventListener);