0
I am using "Comparator" to sort my listview. Sort only 1 element, it is working, but with two the same does not work.
//ordenar por data
arrayAdapter.sort(new Comparator<Vagas>() {
@Override
public int compare(Vagas o1, Vagas o2) {
return o2.getDataAtualizacao().compareTo(o1.getDataAtualizacao());
}
});
And just below it I’m trying to order by name
//ordenar por nome
arrayAdapter.sort(new Comparator<Vagas>() {
@Override
public int compare(Vagas o1, Vagas o2) {
return o1.getNome().compareTo(o2.getNome());
}
});
Theoretically it was not for him to sort by date and then order by name?
If I leave only sorting by name or by date, it orders normally.
Is there any way to do this ordering, using the same Adapter? Or would you have to look for something else to do? If you can quote I thank you for being able to seek and learn
– Flávio
@Flávio corrected the problems that were, see now if it works correctly and tell me.
– viana
he comes to execute but he falls in
if( sComp !=0)
, then it orders only by name. If I change toif (sComp == 0)
he orders by date– Flávio