Skip to content
Advertisement

How to arrange list item in spinner in ascending order

How to arrange items in list descending instead of the image:

enter image description here

to be like this:

JavaScript

and this is the below adapter I use:

JavaScript

and this is the setupPrice() method which I need to arrange the entities in:

JavaScript

Advertisement

Answer

You can implement a Comparator like this for your Sm class before passing it into the adapter. Just like what the first comment said.

JavaScript
Advertisement