[英]How to specify the sort order for the query to a content provider
我正在嘗試從Android中的Sqlite表加載所有項目,並希望訂購結果。
如何指定返回光標的順序?
我通過以下方式通過CursorLoader查詢ContentProvider:
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null,
null, null);
嘗試下面的代碼更改COLUMN_NAME,其中包含您要排序的實際列名稱。
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null,
null, "COLUMN_NAME ASC");
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null,
null, "column_name ASC");
要么
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null,
null, "column_name DESC")
;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.