当前位置: 首页>>代码示例>>Java>>正文


Java Dialog.setOnCancelListener方法代码示例

本文整理汇总了Java中android.app.Dialog.setOnCancelListener方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setOnCancelListener方法的具体用法?Java Dialog.setOnCancelListener怎么用?Java Dialog.setOnCancelListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Dialog的用法示例。


在下文中一共展示了Dialog.setOnCancelListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkGooglePlayServices

import android.app.Dialog; //导入方法依赖的package包/类
public static boolean checkGooglePlayServices(final Activity activity) {
    final int googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
    switch (googlePlayServicesCheck) {
        case ConnectionResult.SUCCESS:
            return true;
        case ConnectionResult.SERVICE_DISABLED:
        case ConnectionResult.SERVICE_INVALID:
        case ConnectionResult.SERVICE_MISSING:
        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(googlePlayServicesCheck, activity, 0);
            dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    activity.finish();
                }
            });
            dialog.show();
    }
    return false;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:21,代码来源:PlayServicesUtils.java

示例2: checkGooglePlayServices

import android.app.Dialog; //导入方法依赖的package包/类
/**
 * A utility method to validate that the appropriate version of the Google Play Services is
 * available on the device. If not, it will open a dialog to address the issue. The dialog
 * displays a localized message about the error and upon user confirmation (by tapping on
 * dialog) will direct them to the Play Store if Google Play services is out of date or
 * missing, or to system settings if Google Play services is disabled on the device.
 */
public static boolean checkGooglePlayServices(final Activity activity) {
    final int googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(
            activity);
    switch (googlePlayServicesCheck) {
        case ConnectionResult.SUCCESS:
            return true;
        default:
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(googlePlayServicesCheck,
                    activity, 0);
            dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    activity.finish();
                }
            });
            dialog.show();
    }
    return false;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:27,代码来源:Utils.java

示例3: showLoading

import android.app.Dialog; //导入方法依赖的package包/类
public LoadingView showLoading(CharSequence msg, boolean cancleabl) {

        mDialog = new Dialog(mContext);// TODO: 2017/8/28 内存泄露时这里也修改为弱引用
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        rootView = View.inflate(mContext, R.layout.dialogui_loading_horizontal, null);
        mLinearLayout = (LinearLayout) rootView.findViewById(R.id.dialogui_ll_bg);
        mProgressBar = (ProgressBar) rootView.findViewById(R.id.pb_bg);
        mTextView = (TextView) rootView.findViewById(R.id.dialogui_tv_msg);
        mTextView.setText(msg);
        mLinearLayout.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        mProgressBar.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
        mTextView.setTextColor(mContext.getResources().getColor(R.color.text_black));
        mDialog.setContentView(rootView);

        if (mDialog != null) {
            if (mDialog.isShowing()) {
                mDialog.dismiss();
            }
            mDialog.setCancelable(cancleabl);
            mDialog.setOnCancelListener(this);
            mDialog.show();
        }
        return this;
    }
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:26,代码来源:LoadingView.java


注:本文中的android.app.Dialog.setOnCancelListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。