My recyclerview with long click is acting a bit weird

My recyclerview is holding the data for the orders that come from the server, and the idea is when you long click on it, an option in a alert dialog will appear telling to open the order, however everytime that i do that, it calls the long click more than one times which goes to different positions, for example, if i want to look at the first order, i would long click on it and it will bring the alert dialog but when i click outside the box, another was there as if it was called when i dont really need it, so i decided to go the code and debug and i saw after the first long click everything went fine but after that it just randomly picked a position and called alert dialog for that position.

So then i decided to space out the rows a bit and see if that will help but it did not.

Here is my code that handles the long click for that recyclerview. Thanks in advanced

Best Answer

Answers

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    I might know what is happening, by any chance when i click outside the alert dialog do i store them somewhere, as i have tried something and at first it called it once, then it started twice and then it went to three time and even four.

  • AtanasAngelovAtanasAngelov Member ✭✭✭

    That is probably going to work but i need to also access the List so that i can get a number from it where the next page will use it to load it.

    Just thinking of a way to get it from the current position as i have done it your way but before i had my long click inside the OnBindingViewHolder.

Sign In or Register to comment.