Reputation: 259
I have a problem with firebase. I'm working with the official documentation for change the displayName
and the url-image of an account. I think that the code is right because is very simple, but it not work very well. The app not always change the display name, but only sometime, also if the app say that the operation is successful.
TextView t = (TextView) findViewById(R.id.txt);
e =(EditText) findViewById(R.id.edt);
Button b = (Button) findViewById(R.id.btn);
user = FirebaseAuth.getInstance().getCurrentUser();
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
.setDisplayName(e.getText().toString())
.setPhotoUri(Uri.parse("www.google.it"))
.build();
user.updateProfile(profileUpdates)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(prova.this, "Name Changed!", Toast.LENGTH_SHORT).show();
}
}
});
}
});
String u = user.getDisplayName();
t.setText(u);
in logcat:
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
edit I did various tests and I saw that the change takes effect but to see the effects I have to make a sign-out and authentication. How do I see the effects immediately?
Upvotes: 3
Views: 1158