1
我有一個ListView由SQLite數據庫中的一系列數據填充。 現在我想根據「project_title」列對列表進行排序。據我所知,我們需要使用ORDER BY使用ORDER BY從SQLite中排序ListView
所以我把那本查詢:
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查詢進行更正嗎?由於