• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ErrorDialogFragment类的典型用法和代码示例

java 11次浏览

本文整理汇总了Java中com.google.android.gms.common.ErrorDialogFragment的典型用法代码示例。如果您正苦于以下问题:Java ErrorDialogFragment类的具体用法?Java ErrorDialogFragment怎么用?Java ErrorDialogFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ErrorDialogFragment类属于com.google.android.gms.common包,在下文中一共展示了ErrorDialogFragment类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

点赞 2

import com.google.android.gms.common.ErrorDialogFragment; //导入依赖的package包/类
@Override
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {
    JSONObject jo = new JSONObject();
    final CordovaInterface mCordova = this.cordova;
    if (action.equals("check")) {
        // Check that Google Play services is available
        final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mCordova.getActivity());
        callbackContext.success(jo.put("isGooglePlayServicesAvailable", resultCode == ConnectionResult.SUCCESS));

        // If Google Play services is available
        if (ConnectionResult.SUCCESS == resultCode) {
            // In debug mode, log the status
            Log.d(GooglePlayServicesCheck.APPTAG, "Google Play Services is available");
            // Continue
            return true;
        } else { // Google Play services was not available for some reason
            mCordova.getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    // Get the error dialog from Google Play services
                    Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(resultCode, mCordova.getActivity(), 0);

                    // If Google Play services can provide an error dialog
                    if (errorDialog != null) {
                        // Create a new DialogFragment in which to show the error dialog
                        ErrorDialogFragment errorFragment = ErrorDialogFragment.newInstance(errorDialog);

                        // Show the error dialog in the DialogFragment
                        errorFragment.show(mCordova.getActivity().getFragmentManager(), GooglePlayServicesCheck.APPTAG);
                    }
                }
            });
        }
    }
    return false;
}
 

开发者ID:rehmatt,
项目名称:cordova-plugin-googleplayservices-check,
代码行数:36,
代码来源:GooglePlayServicesCheck.java

示例2: showErrorDialog

点赞 2

import com.google.android.gms.common.ErrorDialogFragment; //导入依赖的package包/类
private void showErrorDialog(int errorCode) {
    // Create a fragment for the error dialog
    ErrorDialogFragment dialogFragment = new ErrorDialogFragment();
    // Pass the error that should be displayed
    Bundle args = new Bundle();
    args.putInt(DIALOG_ERROR, errorCode);
    dialogFragment.setArguments(args);
    dialogFragment.show(mFragment.getFragmentManager(), "errordialog");
}
 

开发者ID:Lenddo,
项目名称:android-lenddo-onboarding,
代码行数:10,
代码来源:GoogleSignInHelper.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)