usercafe.java
recyclerView.addOnItemTouchListener(new AuthorizeCafes.RecyclerItemClickListener(getApplicationContext(), recyclerView, new AuthorizeCafes.RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
cafe = cafeAdapter.getItemName(position);
Intent intent=new Intent(UserCafe.this, UserProduct.class);
intent.putExtra("name", cafe.name);
intent.putExtra("image", cafe.image);
Toast.makeText(UserCafe.this, cafe.name, Toast.LENGTH_SHORT).show();
startActivity(intent);
}
cafe.java
public class Cafe {
public String name;
public String image;
public Cafe(String name,String image) {
this.name = name;
this.image = image;
}
public Cafe() {}
cafeadapter
public int getItemCount() {
return categoryList.size();
}//loop değerleri kadar döndürür
public class ViewHolder extends RecyclerView.ViewHolder {
//Define textviews
TextView categorytext;
ImageView iv_image;`
I want to make like a background when I clicked for once the cafe's name or image but they coming to usercafe page with recyclerView.
You can create a new variable named
visitedasBoolean.You can do something like this.This is Cafe.class
Once the user click the item. You can update the value.
At the
ViewHolder, you can custom what you want to change. But for this example. I just change the name forcategoryText.