我正在尝试创建一个映射到数据库查询的列表,但是,数据库中的一个字段是时间戳,在显示时应显示为“星期三,3 月 2 日”之类的日期,而不是实际值类似于 1299517239487 的数据库...
我可以通过改写查询或在执行查询后修饰光标来解决此问题,但我更希望简单的光标适配器以特定方式显示此列。
有人知道怎么做吗?
一些代码:
// the desired columns to be bound
String[] columns = new String[] { DBHelper.COL_START_TIME, DBHelper.COL_AMOUNT};
// the XML defined views which the data will be bound to
int[] to = new int[] { R.id.dayMonthDate, R.id.amount};
// create the adapter using the cursor pointing to the desired data as well as the layout information
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.single_activity,cursor, columns, to);
我希望能够在适配器中添加某种后处理器来解决这个问题。
谢谢!