Skip to content

Instantly share code, notes, and snippets.

@alorma
Created December 11, 2014 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alorma/81abef4c1ca7ad995403 to your computer and use it in GitHub Desktop.
Save alorma/81abef4c1ca7ad995403 to your computer and use it in GitHub Desktop.
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