I would like to sort the following listview according to "time". Is there any way i can do that on the following code? So for example that 19:15 appears above 20:30 etc...
I would be very thankful to any kind of help!
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
    List<String> listTime = new ArrayList<String>();
    Collections.sort(listTime);
    final List<String> idsList = new ArrayList<>();
    ArrayAdapter adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, listTime);
    final ListView Time = (ListView) findViewById(R.id.Listtime);
    for (final DataSnapshot ds : dataSnapshot.getChildren()) {
        String user = ds.child("UserName").getValue(String.class);
        String arrival = ds.child("Arrival").getValue(String.class);
        String departure = ds.child("Departure").getValue(String.class);
        String time = ds.child("Time").getValue(String.class);
        String TripID = ds.child("TripID").getValue(String.class);
        idsList.add(TripID);
        String Trips = TextUtils.join("  |  ", new String[]{time, user,  departure, arrival});
        listTime.add(Trips);
        Time.setAdapter(adapter);
        Time.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent = new Intent(AvailableRides.this,RideSelected.class);
                String entry = (String) adapterView.getItemAtPosition(i);
                TextView textView4 = findViewById(R.id.textView30);
                String user = textView4.getText().toString();
                String TripID = idsList.get(i);
                intent.putExtra(EXTRA_MESSAGE10,user);
                intent.putExtra(EXTRA_MESSAGE8, entry);
                intent.putExtra(EXTRA_MESSAGE9, TripID);
                startActivity(intent);
            }
        });
    }
}
 
     
     
    