I am having a weird issue. I have an ArrayAdapter which I am sorting. This displays properly on my screen, however when I check the actual data source, the contents have not been sorted. How can I ensure that sorting my ListAdapter will also sort my data source?
Collections.sort(quotes, new PercentChangeComparator()); //sort my data source (this isn't necessary)
quotesAdapter.sort(new PercentChangeComparator()); //sort my ListAdapter
Toast toast = Toast.makeText(getApplicationContext(),quotes.get(0).getSymbol(), Toast.LENGTH_SHORT);
toast.show(); //this shows that my data source hasn't been updated, even though my ListAdapter presents my ListView in the correctly sorted order.
For example:
If my data source is [10,9,1,20]
after sorting my ListView will show [1,9,10,20]
but the data source will still be [10,9,1,20]
How can I resolve this?