I am still a newbie in android developing and have a problem with my ToDo application.
At the moment my listview displaying all saved ToDo's is only sorted by the first two digits (the days!) of the date but the date is stored in this format: "dd.mm.yyyy"
My target is to sort my listview in ascending order by date (ToDoTable.COLUMN_TODO_START) and time (ToDoTable.COLUMN_TIME_START).
I use the following code at the moment:
public void fillData() {
String[] from = new String[] { ToDoTable.COLUMN_TODO_NAME, ToDoTable.COLUMN_TODO_PLACE, ToDoTable.COLUMN_TODO_START, ToDoTable.COLUMN_TODO_END };
int[] to = new int[] { R.id.todo_name, R.id.todo_place, R.id.todo_start };
getLoaderManager().initLoader(0, null, this);
adapter = new SimpleCursorAdapter(this, R.layout.todo_row_test2, null, from,
to, 0);
setListAdapter(adapter);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = { ToDoTable.COLUMN_ID, ToDoTable.COLUMN_TODO_NAME, ToDoTable.COLUMN_TODO_PLACE, ToDoTable.COLUMN_TODO_START, ToDoTable.COLUMN_TIME_START, ToDoTable.COLUMN_TODO_END, };
CursorLoader cursorLoader = new CursorLoader(this,
DataContentProvider.CONTENT_URI, projection, null, null, ToDoTable.COLUMN_TODO_START + " ASC" );
return cursorLoader;
}
I would be very grateful if someone can help me with this issue especially in the point to sort the list by both criteria (date and time).
Thanks in advance.