EN / USD
32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
How to handle ImageView click inside a row in RecyclerView?
TEP , The Engineering Projects , Calender Question: 09-Mar-2017
TEP , The Engineering Projects , Category In: Computer Software Projects
When I click ImageView, it go to GridView activity with position. When I click others area inside a cardview, it go to ItemDetailActivtiy with position. How to do one line or less than coding when click.
[code]public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView tv_restaurant_name, tv_restaurant_address, tv_restaurant_phone; ImageView imgview; public ViewHolder(View itemView) { super(itemView); tv_restaurant_name = (TextView) itemView.findViewById(R.id.tv_restaurant_name); tv_restaurant_address = (TextView) itemView.findViewById(R.id.tv_restaurant_address); tv_restaurant_phone = (TextView) itemView.findViewById(R.id.tv_restaurant_phone); imgview = (ImageView) itemView.findViewById(R.id.imgview); tv_restaurant_name.setOnClickListener(this); tv_restaurant_address.setOnClickListener(this); tv_restaurant_phone.setOnClickListener(this); imgview.setOnClickListener(this); } @Override public void onClick(View v) { int position = getAdapterPosition(); if (v.getId() == imgview.getId()) { Intent intent = new Intent(context, GridView.class); Bundle bundle = new Bundle(); bundle.putInt("ID", Integer.valueOf(mRestaurantList.get(position).getRestaurantId())); intent.putExtras(bundle); context.startActivity(intent); } else { context.startActivity(new Intent(context, ItemDetailActivtiy.class)); } } }[/code]
TEP , The Engineering Projects , Icon Answer: 0 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.