が、これはいくつかのデータを設定する機能です参照してください。 -
private void addUserChangeListener() {
*** you can initialize your progress dialog here
// User data change listener
mFirebaseDatabase.child(userId).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
User user = dataSnapshot.getValue(User.class);
// Check for null
if (user == null) {
Log.e(TAG, "User data is null!");
return;
}
Log.e(TAG, "User data is changed!" + user.name + ", " + user.email);
*** here you can check if the progress dialog is not null then close your progress dialog here
// Display newly updated name and email
txtDetails.setText(user.name + ", " + user.email);
// clear edit text
inputEmail.setText("");
inputName.setText("");
toggleButton();
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
***also close your progress dialog here
Log.e(TAG, "Failed to read user", error.toException());
}
});
}