0

I need to create an auto scroll-able infinite list with listview where as soon as the list ends it will load the first item again. Now what I have tried so far is that I have created a infinite list by setting integer max value in count of adapter like this:

public override int Count
{
  get
     {
       int count = this.passengerNames.Count > 2 ? int.MaxValue :this.passengerNames.Count;
       return count;
     }
}

Now, my list view opens up in a pop up window. So, I created a Runnable thread by creating a new class & passing its new object in listview.Post() method to auto scroll it like this:

this.passengerNameList.Post(new AutoScrollList(this, this.passengerNameList));

& my Auto scroll class is :

public class AutoScrollList : Java.Lang.Object, Java.Lang.IRunnable {

private readonly TaskFragment fragment;

private ListView passengerList;

public AutoScrollList(TaskFragment fragment, ListView passengerList)
{
    this.fragment = fragment;
    this.passengerList = passengerList;
}


public void Run()
{
    Console.WriteLine("*** Runnable starting");     
    int listViewSize = this.passengerList.Adapter.Count;
    for (int index = 0; index < listViewSize; index++)
    {
        this.passengerList.SmoothScrollToPositionFromTop(this.passengerList.LastVisiblePosition + 100, 0, 100000);
    }
}

}

Now, When I try to open it the UI Hangs & if I change the max value to some random number like 400 then it works but that does not solve my purpose. Can anyone tell me if I am doing it right or not? Any help is appreciated. Thanks in advance...

  • 1
    http://stackoverflow.com/questions/12583419/implement-endless-scroll-on-listview – Oscar Vicente Perez Apr 12 '16 at 05:45
  • Hi Thank you so much for replying & forgive me for not being clear but I want a circular list where is the list has 5 items & as soon as user scrolls the 5th item the first one should appear on screen & the list should be auto scrollable in the start. – user6186610 Apr 18 '16 at 05:02

0 Answers0