So I am using this great resource class which is online to sort two cursors based on a cursor Found:
The on-function of this cursor is sorting between two cursors:
@ Override public boolean onam , Int newpaws) {if (oldness == new position) is true; / * * Find the correct cursor * Because the customer of this cursor (Lists / View) goes to jump to a certain extent in the cursor, a simple cache strategy is used to avoid finding all the cursors from the start. * TODO: Check strategies to optimize random access and * reverse order access. * / Int cache_entry = New rank% ROWCACHESIZE; If (mRowNumCache [cache_entry] == newPosition) {int joe = mCursorCache [cache_entry]; MCursor = mCursors [Joe]; If (amcosor == empty) {log. W (tag, "on-over: cache result in the cursor."); return false; } MCursor.moveToPosition (mCurRowNumCache [cache_entry] [Joe]); MLastCacheHit = cache_entry; Back true; } MCursor = null; Int length = mCursors.length; If (mLastCacheHit> = 0) {for (int i = 0; i & lt; length; i ++) {if (mCursors [i] == faucet); MCursors [i] .moveToPosition (mCurRowNumCache [mLastCacheHit] [i]); }} If (newposition and lieutenant; old position = old position == -1) {for (int i = 0; i & lt; length; i ++) {if (macars [i] == empty) will continue ; MCursors [i] .moveToFirst (); } Older condition = 0; } If (oldness & lt; 0) {oldPosition = 0; } // The smallest iDX = -1 for searching in a new condition; For (int i = old condition; i & lt; = newposition; i ++) {string is the smallest ""; Small idx = -1; For (int j = 0; j & lt; length; j ++) {if (mCursors [j] == faucet || mursurs [j] .isAfterLast ()) {continue; } String current = m cursor [j] .getString (mSortColumns [j]); If (smallest IDX & lt; 0; current.compareToIgnoreCase (short) & lt; 0) {smallest = current; Small idx = j; }} If (i == newposition breaks); If (Maccreshers [the smallest idyx]! = Null) {Emerson [The smallest edix]. Mevateonxt (); }} MCursor = mCursors [smallest idx]; MRowNumCache [cache_entry] = newPosition; MCursorCache [cache_entry] = small idx; For (int i = 0; i
I'm not familiar with how the cursor works, but I was wondering how I would modify the onMove function, such that the sorting of two cursors will be sorted in the desired sequence instead of the default Sequence?
Any ideas will help! Thanks!
No comments:
Post a Comment