0

I have an Android application which loads into a ListView a set of elements from a database (there are 10 elements in my ListView). This elements are always the same and do not change. Also it doesn't loads or adds more from any source or way, they are fixed.

What I want to do is when user scrolls to the bottom of the list (element 10), the next element that appears would be the first one (element 1), then element 2 and so on. Also when user scrolls to the top of the list, the previous element would be the last element on the list (element 10) then element 9 and so on. Like a carousel! Like some kind of "Endless list"!

I have been looking for solutions, but I got no approach using ListView. Only using other type of views, 3D views, animated views or elements which are not suitable for what I have built in my app. I want a simple ListView with no animations or stuff like that.... a simple view.

Also I tried to do it programatically by myself... but results are awkward: sometimes ListView does strange things, sometimes it does nothing.... and sometimes my app just crashes!!!

Has anyone implemented this before or done something similar? Any library or add-in to achieve this? I prefer a solution using ListView because is what I am using, but any idea or similar solutions are accepted.

Thank you so much in advance for the help!!!

Ayuchuco
  • 79
  • 1
  • 13
  • you have a Cursor, right? so wrap it around with a CursorWrapper – pskink Jun 30 '14 at 18:26
  • The problem it's not retrieving objects from the database. In brief, once data is retrieved from the database, the problem is drawing those elements into the ListView in a carousel way as I describe. – Ayuchuco Jun 30 '14 at 20:51
  • again use custom CursorWrapper – pskink Jun 30 '14 at 21:06
  • Can you be more explanatory or specific? I don't know how to use CursorWrapper.... – Ayuchuco Jun 30 '14 at 23:30
  • create a class that extends CursorWrapper and override its two methods: getCount() and moveToPosition() – pskink Jul 01 '14 at 05:47
  • so when the original Cursor returns rows 0, 1 and 2 the wrapper would return: 012012012012012012... – pskink Jul 01 '14 at 18:07
  • In this case and for what I wanted to do, yes, this question is duplicate. Now, how can I mark this question as duplicate or simply just erase it? – Ayuchuco Jul 02 '14 at 00:42

1 Answers1

1

Doing some research, I found the effect what I want (carousel) using ListViews but with another name: Circular ListView in another question in this forum that is suitable and its results are what I expected.

Here is the link to the answer: How to create a closed (circular) ListView?

Thanks for viewing and contribute for solutions!!!

Community
  • 1
  • 1
Ayuchuco
  • 79
  • 1
  • 13