Search code examples
androidandroid-studioandroid-alertdialog

Yes and No option on Alert Dialog is Missing in Android


Im a newbie on Android Programming. Im basically working on our UI but I have this situation wherein the text "Yes/No" is missing but it is functioning. The text are just missing.

Here's the problem

I just got the code also here on stackoverflow.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_up);
}
public void onBackPressed(){
 new AlertDialog.Builder(this)
         .setIcon(android.R.drawable.ic_dialog_alert)
         .setTitle("")
         .setMessage("Are you sure you want to cancel?")
         .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
                 finish();
             }
         })
         .setNegativeButton("No",null)
         .show();

It will be a great help for me if you answer. Thank you so much!


Solution

  • Its not missing please check your theme color in color.xml may be your colorAccent is white change it to other colour