How to make the suggestions in the QSB editable when the user clicks on it? I.e. via an edit icon on the right, like on the Google Search app.
Is there a standard way to do it, or does it require to implement it from scratch, i.e. customized suggestion list item layout in xml with a button, etc.?
I couldn't find any info on that on https://developer.android.com/guide/topics/search/searchable-config.html etc.
Edit: I'm currently trying this for testing, after the search intent is invoked, I start a new search with the query preset - it works but it's too slow, because it closes the search UI and reopens it, which is not what I want. I'd like the search UI to stay open.
@Override
protected void onNewIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
Toast.makeText(this, "TRY TO PLACE QUERY IN QSB: " + query, Toast.LENGTH_LONG).show();
SearchManager searchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE);
searchManager.startSearch(query, true, this.getComponentName(), b, false);
}
}
Same problem here, it's a shame we can't do this. However, since API 11 (Android 3.0), you can provide the
SUGGEST_COLUMN_FLAGS
column in your suggestion results cursor with valueFLAG_QUERY_REFINEMENT
. From the docs, it seems this should be the way to go.While the docs say it's introduced in API 11, I was able to use it on Android 2.3 as well (they probably made it public by mistake). However, although the constants are there on Android 2.3, it doesn't seem to work (I have not tried on 3.0).