我有一个由 SQLite 数据库中的一系列数据填充的 ListView。现在我想根据“project_title”列对列表进行排序。据我所知,我们需要使用 ORDER BY。
所以我把它放在这样的查询中:
ListView listView = (ListView) findViewById(R.id.lstText);
listView.setOnItemClickListener(this);
listView.setAdapter(new MySimpleCursorAdapter(this, R.layout.listitems,
managedQuery(Uri.withAppendedPath(Provider.CONTENT_URI,
Database.Project.NAME), new String[] { BaseColumns._ID,
Database.Project.C_PROJECTTITLE,
Database.Project.C_SMALLIMAGE, Database.Project.C_PROJECTDESCRIPTION, Database.Project.C_BIGIMAGE}, "SELECT " + "project_title"
+" FROM "+"Project"+" ORDER BY "+"project_title"+" COLLATE NOCASE ASC", null, null),
new String[] { Database.Project.C_PROJECTTITLE,
Database.Project.C_SMALLIMAGE, Database.Project.C_PROJECTDESCRIPTION}, new int[] {
R.id.txt_title, R.id.image, R.id.txt_list_desc}));
但随后 ListView 上没有显示任何内容。我应该如何更正我的 ORDER BY 查询?