title: Sorting Listview Java
body: <p>I wish to sort my listView by the variable called score. Anybody know how to do this? Currently here is my code that get's information from a database and displays it in a list view.</p>
  
  <pre><code> List&lt;String&gt; queryTable(){
      List&lt;String&gt; player = new ArrayList&lt;String&gt;();
  
      SQLiteDatabase db = myOpenHelper.getReadableDatabase();
      Cursor cursor = db.query(CustomOpenHelper.TABLE_NAME, null, null, null, null, null, null);
  
      while (cursor.moveToNext()) {
          int id = cursor.getInt(cursor.getColumnIndex("_id"));
          String name = cursor.getString(cursor.getColumnIndex("name"));
          int score = cursor.getInt(cursor.getColumnIndex("score"));
          player.add(id + " --&gt; the player " + name + " has got a score of " + score +"s");
      }
  </code></pre>
  
  <p>So how would I go about sorting this listview by the variable "score"? Thanks guys. </p>