这里是我的代码来检索数据从数据库到一个列表视图。如何只显示数据库的一部分数据到列表视图
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个字符的数据到列表视图。请帮帮我。
谢谢。我的问题解决了 – Santhosh
我想为50个字符以上的文本添加三个点(...)。我如何追加? – Santhosh
我不确定,但这可能是与手机相关的问题。我在模拟器中没有三个点,所以每个手机都可以用它们自己的方式处理这个问题。 – colegu