I have database table with the columns {Name, Time (UTC format) , Latitude, Longitude}
I display the table using a ListActivity with a SimpleCursorAdapter.
I would like that the column Time show the time in a human readable format (13-07-2010 10:40) rather than in UTC format (18190109089).
How can I specify that the values from column Time need some filtering/adaptation?
POSSIBLE SOLUTION (with a problem):
SimpleCursorAdapter offers the method:
setCursorToStringConverter(SimpleCursorAdapter.CursorToStringConverter cursorToStringConverter);
to specify how a class that is able to convert a Cursor to CharSequence (convertToString(Cursor cursor). Anyway I don't know in which format should be the return CharSequence paramater!
You can use
setViewBinder()
, or subclassSimpleCursorAdapter
and overridebindView()
.You can use SQLite syntax on that column to format the date.
Something like this will do it
The simplest way to format a cursor value is to use SimpleCursorAdapter.setViewBinder(..):
i also had the same problem after long struggle finally i found answer :) ( see below )
for example
Going thru this old post, noticed I have done something similar that might help:
}
Usage:
Hope this helps anyone out there !