• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Check if the the selected item in listview is in correct position (index)

But everytime I drag a certain item in its correct position, it immediately goes to the goToScoreFragment even though the other items are still not in their correct position

Right, so think about it, the condition for calling goToScoreFragment() is that all the items need to be in their correct positions. So you need to check all the items in the list before making a decision on what to do next.

The way your code is at the moment, it will call goToScoreFragment() when it finds the first item at the correct position. That's not what you want.
 
Upvote 0
This isn't anything to do with that library. It's about your code. Not everything you wish to do in your program is neatly available in a code fragment you can paste in. At some point you need to write some of your own code. Besides, that's the fun part ;)

So here's a few questions for you:-

1. Do you know what a ListView is?
2. Do you know what an ArrayList is?
3. Do you know how the above two things relate to each other?
4. Do you know what controls the order of items in your ListView?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones