Answers for "view.getId is giving error when is set"

0

view.getId is giving error when is set

public static class ListMenuRowViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    protected NetworkImageView thumbnail;
    protected TextView itemname;
    protected TextView price;
    protected TextView itemtype;
    protected TextView quantity;
    protected ImageView add;
    protected ImageView sub;
    protected ImageView imageView;
    protected CardView item_layout;

    public ListMenuRowViewHolder(View itemView) {
        super(itemView);

        this.thumbnail = (NetworkImageView) itemView.findViewById(R.id.recom);
        this.imageView = (ImageView) itemView.findViewById(R.id.categ);
        this.itemname = (TextView) itemView.findViewById(R.id.itemvalue);
        this.add = (ImageView) itemView.findViewById(R.id.add);
        this.sub = (ImageView) itemView.findViewById(R.id.sub);
        this.price = (TextView) itemView.findViewById(R.id.price);
        this.quantity = (TextView) itemView.findViewById(R.id.quantity);

        this.add.setOnClickListener(this);
        this.sub.setOnClickListener(this);
        //Do this for each view
    }

    @Override
    public void onClick(View v) {
        Log.e("myname", "rohit");
        ItemscardClickListener.onClick(v, getAdapterPosition());
    }
}
Posted by: Guest on July-03-2020

Code answers related to "view.getId is giving error when is set"

Browse Popular Code Answers by Language