Hi guys I searched through other titles relating to white on white text but they do not help me as I encounter this issue when forgot password has been clicked. As you can see all other fields within the dialogue box seem to appear as they should, however my cancel, and recover buttons are unseen until clicked and a very light grey box forms around the buttons.
I have tried to use setTitle(androidcolor.R.black)inside the code but it didnt work haha. I am learning slowly and this may very well be an easy fix but it evades me for now.
This is the code I have run with it hopefully it helps someone help me or at least point me to the right place :)
private void showRecoverPasswordDialog() {
//AlertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Recover Password");
//Set Layout to Linear Layout
LinearLayout linearLayout = new LinearLayout(this);
//Views to set in Dialog
final EditText emailET = new EditText(this);
emailET.setHint("Email");
emailET.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
emailET.setMinEms(16);
linearLayout.addView(emailET);
linearLayout.setPadding(10,10,10,10);
builder.setView(linearLayout);
//Button to Recover
builder.setPositiveButton("Recover", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Input Email for Recovery
String email = emailET.getText().toString().trim();
beginRecovery(email);
}
});
//Button to Cancel
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Dismiss Dialog
dialog.dismiss();
}
});
//Show Dialog
builder.create().show();
}
private void beginRecovery(String email) {
//Show progress dialog
progress_Dialog.setMessage("Recovery Email sending...");
progress_Dialog.show();
mAuth.sendPasswordResetEmail(email).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
progress_Dialog.dismiss();
if(task.isSuccessful()){
Toast.makeText(LoginActivity.this, "Recovery Email has been sent", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(LoginActivity.this, "Recovery Email failed to send ", Toast.LENGTH_SHORT).show();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
progress_Dialog.dismiss();
//Get and Show proper Error Message
Toast.makeText(LoginActivity.this, ""+e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void loginUser(String email, String passw) {
//Show progress dialog
progress_Dialog.setMessage("Logging in...");
progress_Dialog.show();
mAuth.signInWithEmailAndPassword(email, passw)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
//Dismiss progress dialog
progress_Dialog.dismiss();
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = mAuth.getCurrentUser();
//User is logged in, start Login Activity
startActivity(new Intent(LoginActivity.this, ProfileActivity.class));
finish();
} else {
//Dismiss progress dialog
progress_Dialog.dismiss();
// If sign in fails, display a message to the user.
Toast.makeText(LoginActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
//Dismiss progress dialog
progress_Dialog.dismiss();
//Get and show an Error Message
Toast.makeText(LoginActivity.this, ""+e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}