Created
September 26, 2019 15:34
-
-
Save parzibyte/2b2d616fb7a94d7ef19c7451660f474c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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