title: Firebase Sorting Score from Highest to Lowest ~ Android
body: <p>Inside <code>MainActivity</code>, I have this function:</p>
  
  <pre><code> public void sortingData() {
  
      mRootRef = new Firebase("https://fyp-1-43a27.firebaseio.com/User");
      dbSortAllData = FirebaseDatabase.getInstance().getReference();
  
      ListView mLvScore = (ListView) findViewById(R.id.lvScore);
  
      final List&lt;UserInformation&gt; listScore = new LinkedList&lt;&gt;();
      final ArrayAdapter&lt;UserInformation&gt; adapter
              = new ArrayAdapter&lt;UserInformation&gt;
              (this, R.layout.scoreboard_row, listScore) {
  
          @NonNull
          @Override
          public View getView(int position, View view, ViewGroup parent) {
              if (view == null) {
                  view = getLayoutInflater().inflate(R.layout.scoreboard_row, parent, false);
              }
  
              UserInformation item = listScore.get(position);
              ((TextView) view.findViewById(R.id.tvScoreName)).setText(item.getName());
              ((TextView) view.findViewById(R.id.tvScorePoint)).setText(item.getScore());
              return view;
          }
      };
      mLvScore.setAdapter(adapter);
  
      com.firebase.client.Query queryRef = mRootRef.orderByChild("score").startAt("score").endAt("score").limitToFirst(50);
      queryRef.addChildEventListener(new com.firebase.client.ChildEventListener() {
          @Override
          public void onChildAdded(com.firebase.client.DataSnapshot dataSnapshot, String s) {
              UserInformation sI = dataSnapshot.getValue(UserInformation.class);
              listScore.add(sI);
              adapter.notifyDataSetChanged();
          }
  
          @Override
          public void onChildChanged(com.firebase.client.DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onChildRemoved(com.firebase.client.DataSnapshot dataSnapshot) {
  
          }
  
          @Override
          public void onChildMoved(com.firebase.client.DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onCancelled(FirebaseError firebaseError) {
  
          }
      });
  }
  </code></pre>
  
  <p>My Model Class:</p>
  
  <pre><code>public class UserInformation implements Comparable&lt;UserInformation&gt; {
  
      public String name;
      public String age;
      public String score;
  
      public UserInformation() {}
  
      public UserInformation(String name, String age, String score) {
          this.name = name;
          this.age = age;
          this.score = score;
      }
  
      // ... Getters and Setters here. 
  }
  </code></pre>
  
  <p>These piece of code works, it sorts from lowest to highest.</p>
  
  <p>My Problem is how do I sort it from Highest to Lowest? Suggestions and advises are much appreciated.</p>