Hello,
I woule like to sort the results (Documents) of a guery inside an adapter before sending them to listView.
For the moment it works well, i do this in my adapter :
public class LiveQueryAdapter extends BaseAdapter {
public String TAG = "LiveQueryAdapter";
private LiveQuery query;
private QueryEnumerator enumerator;
private Context context;
int i;
public LiveQueryAdapter(Context context, LiveQuery query) {
this.context = context;
this.query = query;
query.addChangeListener(new LiveQuery.ChangeListener() {
@Override
public void changed(final LiveQuery.ChangeEvent event) {
((Activity) LiveQueryAdapter.this.context).runOnUiThread(new Runnable() {
@Override
public void run() {
enumerator = event.getRows();
notifyDataSetChanged();
}
});
}
});
query.start();
Now let’s say that my results (Documents) contain a value String TimeUpdated (DateTime class).
I want to compare TimeUpdated with actual time, and then sort them descending and send them to my listview.
I think i have to do this in an iteration before calling notifyDataSetChanged();
.
Can anyone help me with this ?
Best regards