Code example for AlertDialog.Builder

Methods: setIcon, setNegativeButton, setPositiveButton, setView

0
		view.setPadding(Math.round(mColorPicker.getDrawingOffset()), 0, Math.round(mColorPicker.getDrawingOffset()), 0);
 
		final int val = getValue();
		mColorPicker.setColor(val, true);
		mColorPicker.setAlphaSliderVisible(mAlphaSliderEnabled);
		builder.setView(view);
		builder.setIcon(new BitmapDrawable(context.getResources(), getColorPreviewBitmap(context, val)));
		builder.setPositiveButton(android.R.string.ok, this);
		builder.setNegativeButton(android.R.string.cancel, null);
	} 
 
	@Override 
	protected void onSetInitialValue(final boolean restoreValue, final Object defaultValue) {
		if (isPersistent() && defaultValue instanceof Integer) {
			persistInt(restoreValue ? getValue() : (Integer) defaultValue);
		} 
	} 
 
	private int getValue() { 
		try { 
			if (isPersistent()) {