AlertDialog.Builder alert = new AlertDialog.Builder(AlarmActivity.this); View view = LayoutInflater.from(getBaseContext()).inflate( R.layout.dialog_outofrange_values, null); alert.setTitle(getString(R.string.invalid)) .setIcon(android.R.drawable.ic_dialog_alert) .setMessage(getString(R.string.values_out_of_range)) .setView(view).setNegativeButton(getString(R.string.ok), null) .show();