Code example for ContextThemeWrapper

0
		} 
 
		public Builder(Context context, int theme) {
			P = new AlertController.AlertParams(new ContextThemeWrapper(
					context, resolveDialogTheme(context, theme)));
			P.mTheme = theme;
		} 
 
		public AlertDialog create() { 
			final AlertDialog dialog = new AlertDialog(P.mContext, P.mTheme);
			P.apply(dialog.mAlert);
			dialog.setCancelable(P.mCancelable);
			if (P.mCancelable) {
				dialog.setCanceledOnTouchOutside(true);
			} 
			dialog.setOnCancelListener(P.mOnCancelListener);
			if (P.mOnKeyListener != null) {
				dialog.setOnKeyListener(P.mOnKeyListener);
			} 
			return dialog;
		}