Implementing Own Android Cursoradapter For Search Suggestions - Unknown Exceptions
I have implemented my own cursor adapter to manually handle suggestions, so that I can get rid of the overkill method that android docs proposes. Basically what I do is setOnQueryT
Solution 1:
you have over-complicated this: there is no need for setOnQueryTextListener, just call:
myCursorAdapter.setFilterQueryProvider(this);
searchView.setSuggestionsAdapter(myCursorAdapter);
in onCreateOptionsMenu
, you will need your Activity to implement FilterQueryProvider
where in its runQuery
you return your Cursor
with suggestions
Solution 2:
Just tried it. It works like a charm. The query is working on config changes and it doesnt crash anymore. The only issue is that I am getting these exceptions in logcat everytime the config changes:
03-10 19:39:06.542 30711-30711/com.nikkis.vallabus W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection
03-10 19:39:06.622 30711-30711/com.nikkis.vallabus W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection
03-10 19:39:06.672 30711-30711/com.nikkis.vallabus W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection
03-10 19:39:08.252 30711-30711/com.nikkis.vallabus W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection
Post a Comment for "Implementing Own Android Cursoradapter For Search Suggestions - Unknown Exceptions"