Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private class FakeAdapter extends RecyclerView.Adapter<FakeAdapter.VH> {
private final LayoutInflater inflater;
public FakeAdapter(Context context) {
this.inflater = LayoutInflater.from(context);
}
@Override
public VH onCreateViewHolder(ViewGroup parent, int viewType) {
return new VH(inflater.inflate(android.R.layout.simple_list_item_1, parent, false));
}
@Override
public void onBindViewHolder(VH holder, int position) {
holder.text.setText("Pos: " + position);
}
@Override
public int getItemCount() {
return 100;
}
public class VH extends RecyclerView.ViewHolder {
public TextView text;
public VH(View itemView) {
super(itemView);
text = (TextView) itemView.findViewById(android.R.id.text1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment