当前位置: 首页>>代码示例>>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;未经允许,请勿转载。