RecyclerView Selection Library Tutorial for Android: Adding New Actions |

Learn how to implement press and long-press events on lists with RecyclerView Selection library.

This is a companion discussion topic for the original entry at

Google makes a mess of their documentation: They do not define key terms and when they do, the definitions are ambiguous.
You are not better. I do not want to hurt your feelings, I am telling the truth. If a newbie reads the part on ItemKeyProvider and can understand it, they are a superhuman.
What is a selection key? What is the purpose of getkey or getselectionkey?
Tell your readers this and they will figure out the rest of the code for each function.

Too bad. I stopped reading when I reached this part.

Hello dttt,

The name of these functions corresponds to their actions:

  • getSelectionKey, in this example returns the item id that has just been selected. In other words, the last item youโ€™ve clicked on the list.
  • getKey, from ItemsKeyProvider, returns the current id of a cell. From the article: itโ€™s time to implement the ItemKeyProvider . This class holds the IDโ€™s of the different cells you can select.