Code example for Cursor

Methods: getIntgetStringisAfterLast

0
     */ 
    class CombinedCursor extends CursorSource { 
 
        @Override 
        public SuggestItem getItem() { 
            if ((mCursor != null) && (!mCursor.isAfterLast())) {
                String title = mCursor.getString(1);
                String url = mCursor.getString(2);
                boolean isBookmark = (mCursor.getInt(3) == 1);
                return new SuggestItem(getTitle(title, url), getUrl(title, url),
                        isBookmark ? TYPE_BOOKMARK : TYPE_HISTORY);
            } 
            return null; 
        } 
 
        @Override 
        public void runQuery(CharSequence constraint) {
            // constraint != null 
            if (mCursor != null) {
                mCursor.close();
            }