Normal Alert Dialog in Android

advertisements

The alert dialog appears as a custom alert dialog like the white one. How to make the alert dialog appear normal? Black and blue.

AlertDialog.Builder builder = new AlertDialog.Builder(this)

AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle("Hello") .setIcon(R.drawable.ic_launcher) .setMessage("Hi") .setPositiveButton("Yes", null) .setNegativeButton("No", null) .setNeutralButton("Maybe", null);

Can the Alert Dialog be changed without changing the entire theme?


Try this

ContextThemeWrapper themedContext;

if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ) {
    themedContext = new ContextThemeWrapper( this, android.R.style.Theme_Holo_NoActionBar);
}
else {
    themedContext = new ContextThemeWrapper( this, android.R.style.Theme_Light_NoTitleBar );
}

AlertDialog.Builder builder = new AlertDialog.Builder(themedContext)

   // your dialog code.....