M.V.
M.V.

Reputation: 1672

ListView change order to opposite direction ANDROID

I have a ListView filled with for loop. The data inside ListView is now in direction

and I want it to be in proper direction:

Upvotes: 2

Views: 1119

Answers (3)

Heena M. Patel
Heena M. Patel

Reputation: 144

Use Collections.reverse(arrayList); This will automatically reverse the data.

Upvotes: 0

Thorben
Thorben

Reputation: 6981

Collections.sort is probably what you're up for!

http://www.vogella.de/blog/2009/08/04/collections-sort-java/

Upvotes: 1

Flo
Flo

Reputation: 27455

Just loop in the other direction.

Instead of

for(int i = 1; i < 7; i++){
    // fill array with values ...
}

do

for(int i = 6; i > 0; i--){
    // fill array with values ...
}

Upvotes: 0

Related Questions