title: Android firebase orderByKey doesn't change anything
body: <p>I was searching for two days now, but the firebase topic is really poorly discussed i guess</p>
  
  <p>I want to sort my data from firebase DB to get the weights from the newest to the oldest. I was trying to do it directly with <code>ref.orderByKey</code> and with         <code>Query refQuery = ref.orderByKey();</code> but none seems to work.</p>
  
  <p>The key is a date with <code>yy:MM:dd</code> format, but with that code i'm getting data not sorted in any possible way... Any help?</p>
  
  <p><img src="https://i.stack.imgur.com/QI95A.jpg" alt="screenshot"></p>
  
  <pre><code>final Firebase ref = new Firebase("https://myapp.com/" + FirebaseAuth.getInstance().getCurrentUser().getUid() + "/weight/");
  
  ref.orderByKey().addListenerForSingleValueEvent(new ValueEventListener() {
       @Override
       public void onDataChange(DataSnapshot snapshot) {
          weights = new Double[(int)snapshot.getChildrenCount()];
          dates = new String[(int)snapshot.getChildrenCount()];
          Toast.makeText(getActivity(), "Wczytuje Pierwsze Dane"+snapshot.getValue(), Toast.LENGTH_LONG).show();
          int i = 0;
          for (DataSnapshot child : snapshot.getChildren()) {
              weights[i] = child.getValue(Double.class);
              dates[i] = child.getKey();
              weightMap.put(child.getKey(), child.getValue(Double.class));
              i++;
          }
          testowy.setText(""+weightMap.size());
  
          if(weightMap.size()&gt;1)
          diffValue.setText(""+(weights[weightMap.size()-1] - weights[weightMap.size()-2]));
  
          WeightListAdapter weightList = new WeightListAdapter(weightMap);
          ListView weightListView = (ListView) view.findViewById(R.id.weightList);
          weightListView.setAdapter(weightList);
       }
  
       @Override
       public void onCancelled(FirebaseError firebaseError) {
       }
   });
  </code></pre>
  
  <p>Edit 1:</p>
  
  <pre><code> ref.orderByKey().addListenerForSingleValueEvent(new ValueEventListener() {
                                               @Override
                                               public void onDataChange(DataSnapshot snapshot) {
                                                   weights = new Double[(int)snapshot.getChildrenCount()];
                                                   dates = new String[(int)snapshot.getChildrenCount()];
  
                                                   int i = 0;
                                                   for (DataSnapshot child : snapshot.getChildren()) {
                                                       weights[i] = child.getValue(Double.class);
                                                       dates[i] = dt.format(Long.parseLong(child.getKey()));
                                                       weightMap.put(child.getKey(), child.getValue(Double.class));
                                                       i++;
                                                   }
  </code></pre>
  
  <p>I stood without converting the date for clarity of the question.The snapshot comes unsorted. Why...?</p>
  
  <p><img src="https://i.stack.imgur.com/7g9jk.jpg" alt="screenshot"></p>
  
  <p>Edit 2:
  Is this what you asked me for? </p>
  
  <p><img src="https://i.stack.imgur.com/U4l4M.jpg" alt="screenshot"></p>