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


Java Context.isRestricted方法代码示例

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


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

示例1: resolveMethod

import android.content.Context; //导入方法依赖的package包/类
@NonNull
private void resolveMethod(@Nullable Context context, @NonNull String name) {
    while (context != null) {
        try {
            if (!context.isRestricted()) {
                Method method = context.getClass().getMethod(this.mMethodName, new Class[]{View.class});
                if (method != null) {
                    this.mResolvedMethod = method;
                    this.mResolvedContext = context;
                    return;
                }
            }
        } catch (NoSuchMethodException e) {
        }
        if (context instanceof ContextWrapper) {
            context = ((ContextWrapper) context).getBaseContext();
        } else {
            context = null;
        }
    }
    int id = this.mHostView.getId();
    throw new IllegalStateException("Could not find method " + this.mMethodName + "(View) in a parent or ancestor Context for android:onClick " + "attribute defined on view " + this.mHostView.getClass() + (id == -1 ? "" : " with id '" + this.mHostView.getContext().getResources().getResourceEntryName(id) + "'"));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:AppCompatViewInflater.java

示例2: resolveMethod

import android.content.Context; //导入方法依赖的package包/类
@NonNull
private void resolveMethod(@Nullable Context context, @NonNull String name) {
    while (context != null) {
        try {
            if (!context.isRestricted()) {
                final Method method = context.getClass().getMethod(mMethodName, View.class);
                if (method != null) {
                    mResolvedMethod = method;
                    mResolvedContext = context;
                    return;
                }
            }
        } catch (NoSuchMethodException e) {
            // Failed to find method, keep searching up the hierarchy.
        }

        if (context instanceof ContextWrapper) {
            context = ((ContextWrapper) context).getBaseContext();
        } else {
            // Can't search up the hierarchy, null out and fail.
            context = null;
        }
    }

    final int id = mHostView.getId();
    final String idText = id == View.NO_ID ? "" : " with id '"
            + mHostView.getContext().getResources().getResourceEntryName(id) + "'";
    throw new IllegalStateException("Could not find method " + mMethodName
            + "(View) in a parent or ancestor Context for android:onClick "
            + "attribute defined on view " + mHostView.getClass() + idText);
}
 
开发者ID:wutongke,项目名称:AndroidSkinAnimator,代码行数:32,代码来源:SkinCompatViewInflater.java

示例3: call

import android.content.Context; //导入方法依赖的package包/类
public static void call(Context activity, String title, String message, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(message).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if ((activity instanceof Activity) && !((Activity) activity).isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:DialogUtil.java

示例4: call

import android.content.Context; //导入方法依赖的package包/类
public static void call(Context activity, String title, String message, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(message).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if ((activity instanceof Activity) && !((Activity) activity).isFinishing() && !activity.isRestricted()) {
            dialog.show();
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:DialogUtil.java


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