Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

on item click listener for recyclerview adapter


public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    public TextView cityName;
    public ViewHolder(View view) {
        super(view);
        cityName = (TextView) view.findViewById(R.id.city_name);
        itemView.setOnClickListener(this); // bind the listener
    }
    @Override
    public void onClick(View view) {
        clickListener.onClick(view, getPosition()); // call the onClick in the OnItemClickListener
    }
}
Source by www.codexpedia.com #
 
PREVIOUS NEXT
Tagged: #item #click #listener #recyclerview #adapter
ADD COMMENT
Topic
Name
7+7 =