android.database.Cursor moveToFirst or getCount
Par PlaceOweb le lundi, septembre 28 2015, 21:44 - JAVA - Lien permanent
moveToFirst vs getCount ? Wich is faster on android.database.Cursor ?
It's almost the same time because Cursor.moveToFirst() call SQLiteCursor.getCount().
Look at
- GrepCode / com.google.android / android
- android.database.AbstractCursor
- GrepCode / com.google.android / android / 5.1.1_r1 / android.database.AbstractCursor
- GrepCode / com.google.android / android / 5.1.1_r1 / android.database.AbstractCursor
- GrepCode / com.google.android / android / 2.0_r1 / android.database.AbstractCursor
- GrepCode / com.google.android / android / 5.1.1_r1 / android.database.sqlite.SQLiteCursor
// android.database.AbstractCursor /* These need to be implemented by subclasses */ abstract public int More ...getCount(); public final boolean moveToFirst() { return moveToPosition(0); } public final boolean moveToPosition(int position) { // Make sure position isn't past the end of the cursor final int count = getCount(); // .... } // android.database.sqlite.SQLiteCursor @Override public int More ...getCount() { if (mCount == NO_COUNT) { fillWindow(0); } return mCount; }