Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 26, 2019 15:34
Show Gist options
  • Save parzibyte/2b2d616fb7a94d7ef19c7451660f474c to your computer and use it in GitHub Desktop.
Save parzibyte/2b2d616fb7a94d7ef19c7451660f474c to your computer and use it in GitHub Desktop.
@NonNull
@Override
public ViewHolderMascota onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// Esta es la vista del layout que muestra los detalles de la mascota (fila_mascota.xml)
View vista = LayoutInflater.from(parent.getContext()).inflate(R.layout.fila_mascota, parent, false);
// Crear el viewholder a partir de esta vista. Mira la clase ViewHolderMascota si quieres
final ViewHolderMascota viewHolder = new ViewHolderMascota(vista);
// En el click de la vista (la mascota en general) invocamos a nuestra interfaz personalizada pasándole la vista y la mascota
vista.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
interfazClickRecyclerView.onClick(v, mascotas.get(viewHolder.getAdapterPosition()));
}
});
return viewHolder;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment