recalculatePositionOfItemAt

This method can be used to recalculate the position of the item at the given index, without triggering an onChanged callback.

If you are editing objects in the list such that their position in the list may change but you don't want to trigger an onChange animation, you can use this method to re-position it. If the item changes position, SortedList will call onMoved without calling onChanged.

A sample usage may look like:

    final int position = mSortedList.indexOf(item);
    item.incrementPriority(); // assume items are sorted by priority
    mSortedList.recalculatePositionOfItemAt(position);
In the example above, because the sorting criteria of the item has been changed, mSortedList.indexOf(item) will not be able to find the item. This is why the code above first gets the position before editing the item, edits it and informs the SortedList that item should be repositioned.

Parameters

index

The current index of the Item whose position should be re-calculated.

See also