當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。