Android : How to sort array object by specific string field?

on Saturday, March 28, 2015


This is the class of my object (I need timestamp is a string):



public class Evento{
public String timestamp;

public Evento(String timestamp) {
super();
this.timestamp = timestamp;
}
public String getTimestamp() {
return timestamp;
}
}


In my activity I have:



Evento evento = new Evento[10];
for(int i = 0; i<10; i++)
evento[i] = new Evento(/*Casual String timestamp*/);


Then I have populated the array, how can I sort it by the timestamp inserted?


0 comments:

Post a Comment