11

Android'deki bir Sqlite Tablosundan tüm öğeleri yüklemeye çalışıyorum ve sonucu sipariş etmek istiyorum.Bir içerik sağlayıcısı sorgusu için sıralama düzeni nasıl belirlenir

Döndürülen imlecin sırasını nasıl belirlerim? sıralamak istediği gerçek sütun adı ile kod değişikliği sütunundaki altında

new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, 
      null, null); 
+1

http://stackoverflow.com/questions/20686415/how-to-sort-the-cursorloader-results –

cevap

24

deneyin:

Bir CursorLoader aracılığıyla aşağıdaki şekilde ContentProvider sorgulamak.

new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, 
      null, "COLUMN_NAME ASC"); 
+0

Örneğin, resimler arıyorsanız ve en yeni olanı görmek istiyorsanız - ekleyin: "date_modified DESC " –

6
new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, 
      null, "column_name ASC"); 

veya

new CursorLoader(context, RepresentativeEntityContentProvider.CONTENT_URI, null, null, 
       null, "column_name DESC") 

;

İlgili konular