daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest May 16th, 2018 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package pe.edu.idat.prototiporecyclerview;
  2.  
  3. import android.support.annotation.NonNull;
  4. import android.support.v7.widget.CardView;
  5. import android.support.v7.widget.RecyclerView;
  6. import android.view.LayoutInflater;
  7. import android.view.View;
  8. import android.view.ViewGroup;
  9. import android.widget.ImageView;
  10. import android.widget.TextView;
  11.  
  12. import java.util.List;
  13.  
  14. public class HeladoAD extends RecyclerView.Adapter<HeladoAD.HeladoPH>{
  15.  
  16.  
  17.         List<HeladoBE> pdata;
  18.         HeladoAD(List<HeladoBE>data){
  19.             this.pdata = data ;
  20.         }
  21.  
  22.  
  23.     @NonNull
  24.     @Override
  25.     public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  26.  
  27.             View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.itemmolde,parent,false);
  28.             HeladoPH ph = new HeladoPH(v);
  29.             return ph;
  30.  
  31.     }
  32.  
  33.     @Override
  34.     public void onBindViewHolder(HeladoPH holder, int position) {
  35.        
  36.             holder.im.setImageResource(pdata.get(position).getFoto());
  37.             holder.ti.setText(pdata.get(position).getAbreviatura());
  38.             holder.su.setText(pdata.get(position).getNombre());
  39.            
  40.            
  41.     }
  42.  
  43.     @Override
  44.     public int getItemCount() {
  45.         return pdata.size();
  46.         //cantidad de items que se pintan
  47.  
  48.     }
  49.  
  50.     public static class HeladoPH extends RecyclerView.ViewHolder{
  51.         CardView cv;
  52.         ImageView im;
  53.         TextView ti;
  54.         TextView su;
  55.         HeladoPH(View itemView){super(itemView);
  56.        
  57.         cv = (CardView)itemView.findViewById(R.id.cv);
  58.         im = (ImageView)itemView.findViewById(R.id.imgFoto);
  59.         ti = (TextView)itemView.findViewById(R.id.txtSubTitulo);
  60.         su = (TextView)itemView.findViewById(R.id.txtSubTitulo);
  61.  
  62.  
  63.         }
  64.  
  65.     }
  66.  
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top