0

The int position in my onBindViewHolder is in the red line, I don't know how to identify the problem, and to change the code but when I hover int position, it states there that " Do not treat the position as fixed; only use immediately and call holder.getAdapterPosition() to look it up later ". Please help :(

@Override
    public void onBindViewHolder(@NonNull ViewHolder holder,int position) {
Glide.with(context).load(categoryList.get(position).getImg_url()).into(holder.catImg);

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(context, ViewAllActivity.class);
                intent.putExtra("type",categoryList.get(position).getType());
                context.startActivity(intent);

            }
        });
    }
Syed Rafaqat Hussain
  • 1,009
  • 1
  • 9
  • 33
vly cme
  • 1
  • 1
  • Please edit your question and add the code of your entire method. – Alex Mamo Oct 09 '21 at 12:44
  • Does this answer your question? [Lint error "Do not treat position as fixed; only use immediately..."](https://stackoverflow.com/questions/34942840/lint-error-do-not-treat-position-as-fixed-only-use-immediately) – Ryan M Oct 14 '21 at 07:36

0 Answers0