Skip to content

Instantly share code, notes, and snippets.

View iamutkarshtiwari's full-sized avatar
💭
改善

Utkarsh Tiwari iamutkarshtiwari

💭
改善
  • Expedia Group
  • Seattle, WA
View GitHub Profile
@iamutkarshtiwari
iamutkarshtiwari / RecyclerViewItemOnClickListener.md
Last active October 20, 2017 16:28 — forked from grantland/post.md
RecyclerView item onClickListener implementation

RecyclerView item onClick

RecyclerView does not have an OnItemClickListener like it's predecessor, ListView. However, detecting item clicks is pretty simple.

Set an OnClickListener in your ViewHolder creation:

private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>  {

    public static class ViewHolder extends RecyclerView.ViewHolder