I have a array of cities -
String[] cities = { "Riyadh", "Jubail", "Jeddah", "Madinah",
"Tabuk","Bangalore","Chennai","Pune" };
I am displaying them in a list that has three textview(fixed) .
This means we are going to display three cities at a time.
Here is the method to display the cities.
void setUpCityList(int iCity) {
tvOneCity.setText(cities[iCity]);
tvTwoCity.setText(cities[iCity + 1]);
tvThreeCity.setText(cities[iCity + 2]);
}
When the user swipes up ,i am incrementing the index and the user swipes down i am decrementing the index.
void swipeUp()
{
iCity++;
setUpCityList(iCity);
}
void swipeDown()
{
iCity--;
setUpCityList(iCity);
}
I want to give this list a endless scroll functionality .
That means if the user swipes up - and list reaches the last three elements , it should again start from first element.
Example -
1. Current display - Last three elements - "Bangalore","Chennai","Pune"
2. Swipe up -- Display should be - Chennai , Pune , Riyadh
How can i achieve this functionality .
This is more of a programming question .
Any Help will be highly appreciated.