AppCompatViewInflater.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:boohee_v5.6 作者:
@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) + "'"));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号