Created
January 2, 2018 12:43
-
-
Save alfianyusufabdullah/9dd5b3f5abfb7db1499cf1b6e99ba0d6 to your computer and use it in GitHub Desktop.
adapter
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 AdapterDaftarMahasiswa extends RecyclerView.Adapter<HolderDaftarMahasiswa> { | |
private List<ModelMahasiswa> data; | |
private OnItemClickListener clickListener; | |
public AdapterDaftarMahasiswa(List<ModelMahasiswa> data, OnItemClickListener clickListener) { | |
this.data = data; | |
this.clickListener = clickListener; | |
} | |
@Override | |
public HolderDaftarMahasiswa onCreateViewHolder(ViewGroup parent, int viewType) { | |
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_mahasiswa, parent, false); | |
return new HolderDaftarMahasiswa(v); | |
} | |
@Override | |
public void onBindViewHolder(HolderDaftarMahasiswa holder, int position) { | |
holder.setContent(data.get(position), position, clickListener); | |
} | |
@Override | |
public int getItemCount() { | |
return data.size(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment