Q:

Sorting a filtered sqlite query

So I have a segment of code that retrieves data from a database full of user entries.  I also have an EditText with a text watcher that allows them to filter the entries via their input.  Finally I have a spinner that allows the user to sort the returned queries. 
Everything works except when a user filters the entries then tries to sort them.  At this point all of the entries are reloaded and sorted.  
So it's apparent that the filter is not being re-engaged, however I don't under stand why or what to do to fix it.  
private void displayListView(String sortdata) {
    // TODO Auto-generated method stub
    // Building the list
    info.open();
    Cursor cursor = info.getListData(sortdata);
    info.close();
    String[] listViewColumns = new String[] { Database. KEY_BREWNAME, Database. KEY_BREWERY, Database. KEY_RATING,
            Database. KEY_DATEIMAGENAME, };
    int[] dataToListView = new int[] { R.id.tvBrewName, R.id.tvBrewery, R.id.tvRating, R.id.ivThumb, };
    dataAdapter = new SimpleCursorAdapter(this, R.layout.entrymain, cursor, listViewColumns, dataToListView, 0);
    ViewBinder viewBinder = new ViewBinder() {
        @Override
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            if (!( view instanceof ImageView) || view.getId() ! = R.id.ivThumb) {
                return false;
            }
            ImageView image = (ImageView)view;

            if (new File(Environment.getDataDirectory() + "/data/com.ex.beerlog/files/" + cursor.getString(columnIndex))
                    .exists()) {
                try {
                    FileInputStream fis = openFileInput(cursor.getString(columnIndex));
                    Bitmap bmp1 = BitmapFactory.decodeStream(fis);
                    bmp1 = cropToCicle(bmp1);
                    image.setImageBitmap(bmp1);
                    fis.close();
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else {
                image.setImageResource(R.drawable.bl);
                Log.w("Start", "=-=-=-=-" + cursor.getString(columnIndex) + " === Doesn't exist");
            }
            return true;
        }
    };
    dataAdapter.setViewBinder(viewBinder);
    listview.setAdapter(dataAdapter);

    // What happens when a list item is clicked
    OnItemClickListener onListItemClick = new OnItemClickListener() {
        public void onItemClick(AdapterView<? > listView, View view, int position, long id) {
            Cursor clickCursor = (Cursor)listView.getItemAtPosition(position);
            String clickData = clickCursor.getString(clickCursor.getColumnIndexOrThrow("_id"));
            Bundle backpack = (Bundle)new Bundle();
            backpack.putString("clickdata", clickData); 
            Intent a = new Intent(Start.this, AddEdit.class);
            a.putExtras(backpack);
            startActivity(a);
        }
    };
    listview.setOnItemClickListener(onListItemClick);

    // /Modifying the list entries while the user types, setup a filter
    TextWatcher watchSearch = new TextWatcher() {
        @Override
        public void afterTextChanged(Editable s) {}

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            dataAdapter.getFilter().filter(s.toString());
        }
    };
    sqlSearchText.addTextChangedListener(watchSearch);

    FilterQueryProvider filterQuery = new FilterQueryProvider() {
        public Cursor runQuery(CharSequence constraint) {
            info.open();
            return info.fetchEntriesByName(constraint.toString(), sortSpinValues);
        }
    };
    info.close();
    dataAdapter.setFilterQueryProvider(filterQuery);

}

public void onItemSelected(AdapterView<? > arg0, View arg1, int pos, long arg3) {
    // TODO Auto-generated method stub
    sortSpinValues = sortSpinValue[pos];
    displayListView(sortSpinValues);
}

I figure it's going to probably be something really simple I just can't seem to figure it out. 
Thanks

A:

So spent a little time learning about the way the filters work and realised that I didn't reload the filter after the spinner value was being changed ( or I didn't know what wasn't being reloaded).  so I can up with this extra bit of code to solve the problem. 
if (sqlSearchText.length() > 1) {
            String f = sqlSearchText.getText().toString();
            dataAdapter.getFilter().filter(f);
        }

