Circular / carousel like listview "setSelection"

I have a listview and I gave an effect circular/carousel

to this list by specifying setSelection(SomeHighValueNumber)

. And now I need the actual functionality setSelection(position)

to navigate to a specific position. Since I've already used setSelection

to get a circular effect, how can I achieve this?

For instance

In the adapter class I did the following

        public int getCount() {
            return Integer.MAX_VALUE;

        public Object getItem(int position) {
            return list.get(position%mListAdapterCount);



LvR = (TwoWayView)mainLayoutR.findViewById(;


Now tell me that I want to move to 6th position in the LvR list. I cannot use setSelection again as it removes the carousel effect from my LvR view list.


source to share

1 answer

Finally I found a solution myself. Here you go

For instance

int selection = 500;

LvR.setSelection (selection);

And if you want to go to X position in ListView LvR. Use this

LvR.setSelection (selection + X);



All Articles