Created
January 2, 2018 12:42
-
-
Save alfianyusufabdullah/3bd3065702c556bdf2c11af8c23fdcc2 to your computer and use it in GitHub Desktop.
holder
This file contains hidden or 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
/** | |
* Created by jonesrandom on 1/2/18. | |
* | |
* @site www.androidexample.web.id | |
* @github @alfianyusufabdullah | |
*/ | |
public class HolderDaftarMahasiswa extends RecyclerView.ViewHolder { | |
private TextView rowNamaMahasiswa, rowNimMahasiswa, rowSemesterMahasiswa; | |
public HolderDaftarMahasiswa(View itemView) { | |
super(itemView); | |
rowNamaMahasiswa = itemView.findViewById(R.id.rowNamaMahasiswa); | |
rowNimMahasiswa = itemView.findViewById(R.id.rowNimMahasiswa); | |
rowSemesterMahasiswa = itemView.findViewById(R.id.rowSemesterMahasiswa); | |
} | |
public void setContent(final ModelMahasiswa mahasiswa, final int position, final OnItemClickListener clickListener) { | |
rowNamaMahasiswa.setText(mahasiswa.getNama()); | |
rowNimMahasiswa.setText(mahasiswa.getNim()); | |
rowSemesterMahasiswa.setText("Semester " + mahasiswa.getSemester()); | |
itemView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
clickListener.Click(view, mahasiswa, position); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment