【发布时间】:2011-09-05 13:05:57
【问题描述】:
这是我将数据从数据库检索到列表视图的代码。
private void fillData() {
Cursor c = viewDB.fetchAllRows();
startManagingCursor(c);
String[] from = new String[] { ViewComplaintsDataDB.KEY_NUMBER,
ViewComplaintsDataDB.KEY_DESCRIPTION,
ViewComplaintsDataDB.KEY_LOGGEDBY }; //these three are the fields in my db
int[] to = new int[] { R.id.com_num, R.id.com_desc , R.id.user }; //these three are the textview id's in my listitem.xml file
SimpleCursorAdapter simple = new SimpleCursorAdapter(this,
R.layout.listitem, c, from, to);
setListAdapter(simple);
}
这是有效的。
我的数据库第二列下的每一行都有很多数据。我怎样才能从第二个字段中只显示 50 个字符的数据到列表视图。请帮帮我。
【问题讨论】:
标签: android database listview simplecursoradapter