Firebase cannot get the last insert value
<p>I have a small firebase database with a list. How can I get the last inserted value of the list?
The elements of the list have as key a date string, example:</p>

<pre><code> 2016_05_29 --&gt; data
 2016_05_30 --&gt; data
 2016_05_31
 2016_06_01
 2016_06_02
 2016_06_03
 2016_06_10
 2016_06_11
 2016_06_12
 2016_06_13
 2016_06_14
 2016_06_15
 2016_06_16
 2016_06_17
 2016_06_18
 2016_06_19 //returned value
 2016_06_20
 2016_06_21
 2016_06_22
 2016_06_23 //expected value
</code></pre>

<p>I am try to get the last value of this list, so 2016_06_23 but for some reason it returns this 2016_06_19 whatever key/order system I use:</p>

<pre><code>Query dateMaxRef = ref.orderByKey().limitToLast(1); //this returns always 2016_06_19 instead of 2016_06_23 
dateMaxRef.addListenerForSingleValueEvent(new ValueEventListener() 
</code></pre>

<p>....</p>

<p>Any idea?</p>