当前位置: 首页 > 知识库问答 >
问题:

android.content.res.resources$NotFoundException:资源ID#0x7F07007E

凌恩
2023-03-14

回收器自定义适配器

public class PostAdapterViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

TextView title,user,description,tag,time,designation;
Long date;
ImageView imageView,bookmark,profilepic,sharebutton,like;
RelativeLayout head;
LinearLayout content;
DatabaseReference reference;
Context context;
String name;

public void setContext(Context context) {
    this.context = context;
}

public PostAdapterViewHolder (final View itemView) {
    super(itemView);
    itemView.setOnClickListener(this);
    head = (RelativeLayout) itemView.findViewById(R.id.head);
    content = (LinearLayout) itemView.findViewById(R.id.content);
    imageView =(ImageView)itemView.findViewById(R.id.imageview);
    designation = (TextView) itemView.findViewById(R.id.designation);
    like =(ImageView)itemView.findViewById(R.id.like);
    profilepic = (ImageView) itemView.findViewById(R.id.imageView2);
    bookmark =(ImageView)itemView.findViewById(R.id.bookmark);
    title = (TextView) itemView.findViewById(R.id.title);
    description = (TextView) itemView.findViewById(R.id.description);
    time = (TextView) itemView.findViewById(R.id.date);
    tag = (TextView) itemView.findViewById(R.id.tag);
    sharebutton = (ImageView) itemView.findViewById(R.id.sharebutton);
    user = (TextView) itemView.findViewById(R.id.username);

    like.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            ImageView i = (ImageView) itemView.findViewById(R.id.like);
            Drawable a = i.getBackground();

            if (a.getConstantState().equals(context.getDrawable(R.drawable.emptyup).getConstantState())){

                i.setImageDrawable(context.getDrawable(R.drawable.fillup));

            } else {

                i.setImageDrawable(context.getDrawable(R.drawable.emptyup));

            }

        }
    });

  }
} 

01-09 10:43:45.747 660 2-6602/Ctize.connectplus.com.communitize E/AndroidRuntime:致命异常:主进程:Ctize.connectplus.com.communitize,PID:6602 Android.content.res.resources$NotFoundException:资源ID#0x7F07007E在Android.content.res.resources.getValue(resources.java:1397)在Android.content.res.resources.getDrawable(resources.java:843)在init.main(zygoteInit.java:616)

共有1个答案

江煜
2023-03-14

你的应用程序崩溃时,有关的活动应该显示?

并将drawable V-24目录中的drawable拖放到drawable目录中。

仅此而已。试试看可以吗

编辑:我发现这个问题可能出现在Android6 API 23上,但不会出现在更高的API上

 类似资料: