私は奇妙な問題を抱えています。並べ替えている ArrayAdapter があります。これは私の画面では正しく表示されますが、実際のデータ ソースを確認すると、内容がソートされていません。ListAdapter をソートすると、データ ソースもソートされるようにするにはどうすればよいですか?
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.
例: データ ソースが[10,9,1,20]
並べ替えた後、ListView が表示されます[1,9,10,20]
ただし、データ ソースは引き続き[10,9,1,20]
どうすればこれを解決できますか?