I have a list using RecyclerView and a OnClickListener to handle the item clicks.
I used the same solution from: Why doesn't RecyclerView have onItemClickListener()? And how RecyclerView is different from Listview?
public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener {
public TextView txtViewTitle;
public ImageView imgViewIcon;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
itemLayoutView.setOnClickListener(this);
txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.item_title);
imgViewIcon = (ImageView) itemLayoutView.findViewById(R.id.item_icon);
}
@Override
public void onClick(View v) {
// start a new fragment
}
}
The problem is that if I quickly select two items, it will execute the onClick() two times and on this case, starting two new fragments.
Am I doing something wrong? What is the best approach to avoid this? Is a simple boolean flag enough for all the cases?
UPDATE: This is a "pack selection screen", which you will select which pack you want to play. Then it will show a new fragment with all the puzzles from the selected pack.
Thanks!