Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. @Override
  2. public int getItemCount() {return description_list.size();}
  3.  
  4. class ItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
  5. ImageView iv_product;
  6. TextView tv_description;
  7. Button btn_detail;
  8.  
  9. public ItemViewHolder(View itemView){
  10. super(itemView);
  11. iv_product = itemView.findViewById( R.id.product_iv );
  12. tv_description = itemView.findViewById( R.id.description );
  13. btn_detail = itemView.findViewById( R.id.detail_btn );
  14. btn_detail.setOnClickListener( this );
  15.  
  16. }
  17.  
  18. // Button Function
  19. @Override
  20. public void onClick(View v){
  21. if (v == btn_detail){
  22. Intent i = new Intent( ctx, DetailActivity.class );
  23. i.putExtra( "image", image_list.get( getAdapterPosition() ) );
  24. i.putExtra( "text", description_list.get( getAdapterPosition() ) );
  25. ctx.startActivity( i );
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement