Code example for Cursor

Methods: getCountisClosedregisterContentObserver

0
     * Unit tests call this directly to inject a mock cursor. 
     */ 
    /* package */ void onCursorOpenDone(Cursor cursor) {
        try { 
            closeCursor(); 
            if (cursor == null || cursor.isClosed()) {
                mTotalMessageCount = 0;
                mCurrentPosition = 0;
                return; // Task canceled 
            } 
            mCursor = cursor;
            mTotalMessageCount = mCursor.getCount();
            mCursor.registerContentObserver(mObserver);
            adjustCursorPosition(); 
        } finally { 
            mLoadMessageListTask = null; // isTaskRunning() becomes false.
        } 
    } 
}