Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter listview populated from database doesn't display results for non latin characters
    text
    copied!<p>I have a listview which displays database's records and a textWatcher to filter the displayed items. The problem is that this works fine for latin characters, but not for unicode. Unicode displayed fine though. Here is the related code:</p> <pre><code>etFilter.addTextChangedListener(new TextWatcher() { 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()); } public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } }); dataAdapter.setFilterQueryProvider(new FilterQueryProvider() { public Cursor runQuery(CharSequence constraint) { return provider.fechDobjectsByName(constraint.toString()); } }); </code></pre> <p>I didn' t find any related question here. Does anybody knows how is done? EDIT: Sorry this was my mistake. Search with Unicode characters display the results, but is case sensitive. I just now realized this. So, how can search and display the result no matter if letters are Capital or not?</p> <pre><code>public Cursor fechDobjectsByName(String inputText) throws SQLException { Cursor mCursor = null; if (inputText == null || inputText.length () == 0) { mCursor = database.query(DbHelper.TABLE_SONGS, new String[] {DbHelper.COLUMN_ID, DbHelper.COLUMN_SONGNAME, DbHelper.COLUMN_SONGARTIST, DbHelper.COLUMN_SONGGENRE}, null, null, null, null, null); } else { mCursor = database.query(true, DbHelper.TABLE_SONGS, new String[] {DbHelper.COLUMN_ID, DbHelper.COLUMN_SONGNAME, DbHelper.COLUMN_SONGARTIST, DbHelper.COLUMN_SONGGENRE}, DbHelper.COLUMN_SONGNAME + " like '%" + inputText + "%'", null, null, null, null, null); } if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload