本文整理匯總了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) + "'"));
}
示例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);
}
示例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) {
}
}
}
}
示例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();
}
}
}