question: @ Override public Cursor runQueryOnBackgroundThread ( CharSequence constraint ) { if ( DBG ) Log . d ( LOG_TAG , "runQueryOnBackgroundThread(" + constraint + ")" ) ; String query = ( constraint == null ) ? "" : constraint . toString ( ) ; Cursor cursor = null ; if ( mSearchView . getVisibility ( ) != View . VISIBLE || mSearchView . getWindowVisibility ( ) != View . VISIBLE ) { return null ; } try { cursor = getSuggestions ( query , QUERY_LIMIT ) ; if ( cursor != null ) { cursor . getCount ( ) ; return cursor ; } } catch ( RuntimeException e ) { Log . w ( LOG_TAG , "Search suggestions query threw an exception." , e ) ; } return null ; }
target:  Use the search suggestions provider to obtain a live cursor.  This will be called in a worker thread, so it's OK if the query is slow (e.g. round trip for suggestions). The results will be processed in the UI thread and changeCursor() will be called.