Im having a search view in my action bar and i want to restore the query after orientation changed. How can I do this? Setting the query from the bundle using SearchView.setQuery(query, false);
doesn't work as the searchview sets its query to ""
as soon as it expands.
Heres the relevant code in my onActivityCreated
:
if(savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_KEY_SEARCH))
mCurFilter = savedInstanceState.getString(BUNDLE_KEY_SEARCH);
And here my onSaveInstanceState
:
savedInstanceState.putString(BUNDLE_KEY_SEARCH, mCurFilter);
super.onSaveInstanceState(savedInstanceState);
So how can I restore its state as im not able to do it using setQuery
?
Thanks to all