I am trying to load all items from a Sqlite Table in Android and want to order the result.
How do I specify the order for the returned cursor?
I query the ContentProvider through a CursorLoader the following way:
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, null, null);
Content URIs A content URI is a URI that identifies data in a provider.
onCreate() which is called to initialize the provider.
A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ContentResolver class. A content provider can use different ways to store its data and the data can be stored in a database, in files, or even over a network.
try below code change COLUMN_NAME with actual column name on which you wants to sort.
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, null, "COLUMN_NAME ASC");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With