當前位置: 首頁>>代碼示例>>Java>>正文


Java AlertDialog.setOnCancelListener方法代碼示例

本文整理匯總了Java中android.app.AlertDialog.setOnCancelListener方法的典型用法代碼示例。如果您正苦於以下問題:Java AlertDialog.setOnCancelListener方法的具體用法?Java AlertDialog.setOnCancelListener怎麽用?Java AlertDialog.setOnCancelListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.AlertDialog的用法示例。


在下文中一共展示了AlertDialog.setOnCancelListener方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public  Dialog createDialog() {
    mAdapter = new ArrayAdapter<String>(CustomizeLaunchersActivity.this, R.layout.add_list_item);
    mAdapter.add(getString(R.string.custom_icon_select_picture));
    mAdapter.add(getString(R.string.custom_icon_icon_packs));
    if (SpecialIconStore.hasBitmap(CustomizeLaunchersActivity.this, mAppClicked.getComponentName(), SpecialIconStore.IconType.Custom)) {
        mAdapter.add(getString(R.string.custom_icon_clear_icon));
    }

    final AlertDialog.Builder builder = new AlertDialog.Builder(CustomizeLaunchersActivity.this);
    builder.setTitle(R.string.custom_icon_select_icon_type);
    builder.setAdapter(mAdapter, this);

    //builder.setInverseBackgroundForced(false);

    AlertDialog dialog = builder.create();
    dialog.setOnCancelListener(this);
    dialog.setOnDismissListener(this);
    dialog.setOnShowListener(this);
    return dialog;
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:21,代碼來源:CustomizeLaunchersActivity.java

示例2: createDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
private Dialog createDialog() {
	
	if (mDialog != null) return mDialog;
	
	Activity activity = mActivity;
	
	// load main view
	final LayoutInflater factory = LayoutInflater.from(activity);
	final View dialog = factory.inflate(R.layout.settings_volume_streams, null);
	final ViewGroup parent = (ViewGroup) dialog.findViewById(R.id.placeholder);
	
	// local cache
	final int[] stringIds = STRING_IDS;
	final int length = stringIds.length;
	final SeekBar[] seekBars = mSeekBars = new SeekBar[length];
	final TextView[] valueViews = mValueViews = new TextView[length]; 		
	mVolumes = new int[length];
	
	// add controls for all stream
	for (int i=0; i<length; i++) {
		
		View control = factory.inflate(R.layout.row_volume, null);
		
		// init text
		TextView text = (TextView) control.findViewById(R.id.text);
		text.setText(stringIds[i]);

		// init values
		valueViews[i] = (TextView) control.findViewById(R.id.value);

		// init seekbars
		SeekBar seekBar = (SeekBar) control.findViewById(R.id.seekbar);
		seekBar.setOnSeekBarChangeListener(this);
		seekBar.setId(mIdCounter++); // workaround for seekbar id bug
		seekBar.setTag(i);
		seekBars[i] = seekBar;
		
		// add to parent
		parent.addView(control);

		//Log.d(TAG, "create: index: " + i + ", seekbar: " + seekBar);
	}
	
	AlertDialog d = new AlertDialog.Builder(activity)
		.setIcon(R.drawable.ic_dialog_menu_generic)
		.setTitle(R.string.txt_volume)
		.setView(dialog)
		.setPositiveButton(R.string.btn_set, this)
		.setNegativeButton(R.string.btn_calcel, this)
		.create();
	
	d.setOnCancelListener(this);
	
	return d;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:56,代碼來源:VolumeSettingHandler.java

示例3: showError

import android.app.AlertDialog; //導入方法依賴的package包/類
/**
 * Shows an error message.
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            the message.
 * @param listener
 *            will be called after the user cancelled the dialog.
 */
public static void showError(Context context, CharSequence msg,
        DialogInterface.OnCancelListener listener) {
    AlertDialog dlg = newAlertDlg(context);
    dlg.setIcon(android.R.drawable.ic_dialog_alert);
    dlg.setTitle(R.string.afc_title_error);
    dlg.setMessage(msg);
    dlg.setOnCancelListener(listener);
    dlg.show();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:20,代碼來源:Dlg.java

示例4: confirmYesno

import android.app.AlertDialog; //導入方法依賴的package包/類
/**
 * Shows a confirmation dialog.
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            the message.
 * @param onYes
 *            will be called if the user selects positive answer (a
 *            <i>Yes</i> or <i>OK</i>).
 * @param onNo
 *            will be called after the user cancelled the dialog.
 */
public static void confirmYesno(Context context, CharSequence msg,
        DialogInterface.OnClickListener onYes,
        DialogInterface.OnCancelListener onNo) {
    AlertDialog dlg = newAlertDlg(context);
    dlg.setIcon(android.R.drawable.ic_dialog_alert);
    dlg.setTitle(R.string.afc_title_confirmation);
    dlg.setMessage(msg);
    dlg.setButton(DialogInterface.BUTTON_POSITIVE,
            context.getString(android.R.string.yes), onYes);
    dlg.setOnCancelListener(onNo);
    dlg.show();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:26,代碼來源:Dlg.java


注:本文中的android.app.AlertDialog.setOnCancelListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。