@Override public void onClick(View view) { CustomerViewHolder holder = (CustomerViewHolder) view.getTag(); int position = holder.getAdapterPosition(); Contact item = contacts.get(position); Toast.makeText(context, item.getName(), Toast.LENGTH_SHORT).show(); }
@Override public void onBindViewHolder(CustomerViewHolder customerViewHolder, int i) { Contact contact = contacts.get(i); Picasso.with(context) .load(contact.getImage()) .error(R.drawable.ic_launcher) .placeholder(R.drawable.ic_launcher) .into(customerViewHolder.image); customerViewHolder.name.setText(contact.getName()); customerViewHolder.rltItem.setTag(customerViewHolder); customerViewHolder.rltItem.setOnClickListener(onClickListener); }