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


Java AlertDialog.setCancelable方法代碼示例

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


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

示例1: onEnterStartedState

import android.app.AlertDialog; //導入方法依賴的package包/類
private void onEnterStartedState() {
    Log.d(TAG, "call onEnterStartedState");
    /* Connect camera */
    if (!connectCamera(getWidth(), getHeight())) {
        AlertDialog ad = new AlertDialog.Builder(getContext()).create();
        ad.setCancelable(false); // This blocks the 'BACK' button
        ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
        ad.setButton(DialogInterface.BUTTON_NEUTRAL,  "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                ((Activity) getContext()).finish();
            }
        });
        ad.show();

    }
}
 
開發者ID:SCHS-Robotics,項目名稱:Team9261-2017-2018,代碼行數:18,代碼來源:CameraBridgeViewBase.java

示例2: handleEmptyLibrary

import android.app.AlertDialog; //導入方法依賴的package包/類
private void handleEmptyLibrary() {
    container.setClickable(true);
    container.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            for (TextView t : ts) {
                startTextInAnim(t);
            }

            int color = ColorUtils.getRandomBrunetColor();
            GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TL_BR,
                    new int[]{
                            android.support.v4.graphics.ColorUtils.setAlphaComponent(color, 100),
                            color,
                    });
            v.setBackground(gd);
        }
    });

    DialogProvider p = new DialogProvider(this);
    AlertDialog dialog = p.createInfosDialog(getString(R.string.tip), getString(R.string.info_empty_library_when_start));
    dialog.setCancelable(true);
    dialog.show();
}
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:25,代碼來源:SplashActivity.java

示例3: onEnterStartedState

import android.app.AlertDialog; //導入方法依賴的package包/類
private void onEnterStartedState() {
    /* Connect camera */
    if (!connectCamera(getWidth(), getHeight())) {
        AlertDialog ad = new AlertDialog.Builder(getContext()).create();
        ad.setCancelable(false); // This blocks the 'BACK' button
        ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
        ad.setButton(DialogInterface.BUTTON_NEUTRAL,  "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                ((Activity) getContext()).finish();
            }
        });
        ad.show();

    }
}
 
開發者ID:hollaus,項目名稱:TinyPlanetMaker,代碼行數:17,代碼來源:CameraBridgeViewBase.java

示例4: showDialogPrivince

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogPrivince(){
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_select_province, null);
    dialog.setContentView(view_dialog);

    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_item_title);
    RecyclerView rv_select = (RecyclerView) view_dialog.findViewById(R.id.rv_item_select);
    tv_title.setText("選擇省份");

    GridLayoutManager layoutManager = new GridLayoutManager(context, 4);
    rv_select.setLayoutManager(layoutManager);
    Rv_SelectProvinceAdapter adapter = new Rv_SelectProvinceAdapter(context, dataProvinces);
    rv_select.setAdapter(adapter);

    adapter.setOnItemClickListener(new Rv_SelectProvinceAdapter.OnItemClickListener() {
        @Override
        public void onClick(int position) {
            if (position != 0) {
                positionProvince = position;
                tv_addAddress_province.setText(dataProvinces.get(position).name);
                province = dataProvinces.get(position).name;
                dialog.dismiss();
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:31,代碼來源:AddAddressActivity.java

示例5: showDialogPlace

import android.app.AlertDialog; //導入方法依賴的package包/類
void showDialogPlace() {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_edit, null);
    dialog.setContentView(view_dialog);

    final EditText et_content = (EditText) view_dialog.findViewById(R.id.et_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    et_content.setText(myInfo.permanentPlace != null ? myInfo.permanentPlace : "");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String content = et_content.getText().toString().trim();
            if (!content.isEmpty()) {
                myInfo.permanentPlace = content;
                et_info_liveAddress.setText(content);
                dialog.dismiss();
            }
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:34,代碼來源:MyInfoActivity.java

示例6: showSubtypeSelectorAndSettings

import android.app.AlertDialog; //導入方法依賴的package包/類
private void showSubtypeSelectorAndSettings() {
    final CharSequence title = getString(R.string.english_ime_input_options);
    // TODO: Should use new string "Select active input modes".
    final CharSequence languageSelectionTitle = getString(R.string.language_selection_title);
    final CharSequence[] items = new CharSequence[] {
            languageSelectionTitle,
            getString(ApplicationUtils.getActivityTitleResId(this, SettingsActivity.class))
    };
    final String imeId = mRichImm.getInputMethodIdOfThisIme();
    final OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(DialogInterface di, int position) {
            di.dismiss();
            switch (position) {
            case 0:
                final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
                        imeId,
                        Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
                                | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.putExtra(Intent.EXTRA_TITLE, languageSelectionTitle);
                startActivity(intent);
                break;
            case 1:
                launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA);
                break;
            }
        }
    };
    final AlertDialog.Builder builder = new AlertDialog.Builder(
            DialogUtils.getPlatformDialogThemeContext(this));
    builder.setItems(items, listener).setTitle(title);
    final AlertDialog dialog = builder.create();
    dialog.setCancelable(true /* cancelable */);
    dialog.setCanceledOnTouchOutside(true /* cancelable */);
    showOptionDialog(dialog);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:38,代碼來源:LatinIME.java

示例7: alterDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public static AlertDialog alterDialog(Context context,View view){
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setView(view);
    AlertDialog dialog = builder.show();
    dialog.setCancelable(false);
    Window window=dialog.getWindow();
    window.setGravity(Gravity.CENTER);
    window.setWindowAnimations(R.style.popwinAnim);
    return dialog;
}
 
開發者ID:dufangyu1990,項目名稱:JKApp,代碼行數:11,代碼來源:Util.java


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