Пример #1
0
        public override android.database.Cursor runQueryOnBackgroundThread(java.lang.CharSequence
                                                                           constraint)
        {
            string query = (constraint == null) ? string.Empty : constraint.ToString();

            android.database.Cursor cursor = null;
            //mSearchView.getWindow().getDecorView().post(mStartSpinnerRunnable); // TODO:
            try
            {
                cursor = mSearchManager.getSuggestions(mSearchable, query, QUERY_LIMIT);
                // trigger fill window so the spinner stays up until the results are copied over and
                // closer to being ready
                if (cursor != null)
                {
                    cursor.getCount();
                    return(cursor);
                }
            }
            catch (java.lang.RuntimeException e)
            {
                android.util.Log.w(LOG_TAG, "Search suggestions query threw an exception.", e);
            }
            // If cursor is null or an exception was thrown, stop the spinner and return null.
            // changeCursor doesn't get called if cursor is null
            // mSearchView.getWindow().getDecorView().post(mStopSpinnerRunnable); // TODO:
            return(null);
        }
Пример #2
0
 internal override android.widget.Filter.FilterResults performFiltering(java.lang.CharSequence
                                                                        constraint)
 {
     android.database.Cursor             cursor  = mClient.runQueryOnBackgroundThread(constraint);
     android.widget.Filter.FilterResults results = new android.widget.Filter.FilterResults
                                                       ();
     if (cursor != null)
     {
         results.count  = cursor.getCount();
         results.values = cursor;
     }
     else
     {
         results.count  = 0;
         results.values = null;
     }
     return(results);
 }