I'm querying firebase based on the dates. I find my query, but it doesn't look like firebase. The order of this is important to me. another picture link : firebase
-LP6nkhewJCIGplnE6L4 adSoyad: "RUKIYE POLAT" tarih: "18/10/2018,18:33:02" -LP7EBqo6pabsweqH-4G adSoyad: "RUKIYE POLAT" tarih: "18/10/2018,20:32:56" -LPBblB72HizL1LaJDIp adSoyad: "RUKIYE POLAT" tarih: "19/10/2018,16:58:45" -LPCNo2DoDkArJJUQMCp adSoyad: "RUKIYE POLAT" tarih: "19/10/2018,20:33:01" -LPF-MEziEXaoaNezNHQ adSoyad: "RUKIYE POLAT" tarih: "20/10/2018,8:45:03" -LPGfoeIVNGq1MRmOEbY adSoyad: "RUKIYE POLAT" tarih: "20/10/2018,16:34:34" -LPGfpCRniADm6sgGWyy adSoyad: "RUKIYE POLAT" tarih: "20/10/2018,16:34:34" -LPK8Puua1kLv5eV7NOF adSoyad: "RUKIYE POLAT" tarih: "21/10/2018,8:42:44" -LPLqoKyV_YiaMqKozxb adSoyad: "RUKIYE POLAT" tarih: "21/10/2018,16:40:42" -LPLqosW54-5q8hUfNoK adSoyad: "RUKIYE POLAT" tarih: "21/10/2018,16:40:43"
sample, in Firebase
Date: 20/10 / 2018,8: 32
there is another child under Date: 20/10 / 2018,16: 39
I also want to come like in this order. According to the time from the database ie in the order of the list as in the firebase.But Firstly,is coming
Date: 20/10 / 2018,16: 39
Date: 20/10 / 2018,8: 32
But I want to as listed above
first
Date: 20/10 / 2018,8: 32
Date: 20/10 / 2018,16: 39
another picture link :https://i.hizliresim.com/j691AL.jpg
application
There are a lot of data in the database, so I can't fix it.
DatabaseReference dbGelenler = db.getReference(kimlik+"/"+cekilensifre+"/"+cekilenisim);
Query query = dbGelenler.orderByChild("tarih").startAt(birincitarih).endAt(birincitarih + "\uf8ff");
query.addListenerForSingleValueEvent(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
List<String> isimler = new ArrayList<String>();
for (DataSnapshot anahtar : dataSnapshot.getChildren()) {
String isim = anahtar.getValue(ornekogrencigetir.class).getAdSoyad();
String tarih = anahtar.getValue(ornekogrencigetir.class).getTarih();
HashMap<String, String> user = new HashMap<>();
if (isimler.indexOf(isim) == -1) {
user.put("hashdurum", "Giriş");
String[] seperated;
seperated = tarih.split(",");
user.put("hashtarih", seperated[0]);
user.put("hashsaat", seperated[1]);
} else {
user.put("hashdurum", "Çıkış");
String[] seperated1;
seperated1 = tarih.split(",");
user.put("hashtarih", seperated1[0]);
user.put("hashsaat", seperated1[1]);
}
isimler.add(isim);
veriler.add(user);
Why doesn't the query take a sequential manner? How can I fix this?
Edit:Error Solved:
The query information is sorted by time. Some times in my database does not contain 0 in front. These are the hours until 10 o'clock in the morning after 12 o'clock. For example, a.m 9. Therefore, when comparing the firebase clock, refer to the next one. Example of the situation 9:12:15 to 15:24:54 the situation he compares here is 91 and 15, so he takes 15: 24: 54 first and then gets 9:12:15.