{"id":4536,"date":"2014-03-30T13:23:26","date_gmt":"2014-03-30T13:23:26","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/set-search-hint-dynamically-collection-of-common-programming-errors\/"},"modified":"2014-03-30T13:23:26","modified_gmt":"2014-03-30T13:23:26","slug":"set-search-hint-dynamically-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/set-search-hint-dynamically-collection-of-common-programming-errors\/","title":{"rendered":"Set search hint dynamically-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li>\n<p>In the manifest the dummy activity was associated with the new searchable2.xml:<\/p>\n<pre><code>\n    \n        \n        \n    \n    \n\n\n\n\n    \n        \n        \n    \n    \n\n<\/code><\/pre>\n<\/li>\n<li>\n<p>In &#8216;MainActivity&#8217; I overrode &#8216;onSearchRequested()&#8217; to reference the appropriate searchable activity:<\/p>\n<pre><code>\npublic boolean onSearchRequested() { SearchManager searchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE);<br \/> if(searchManager!=null) { \/\/ start the search with the appropriate searchable activity \/\/ so we get the correct search hint in the search dialog if(\/* your condition here *\/) searchManager.startSearch(null, false,new ComponentName(this, MainActivity.class), null, false); else searchManager.startSearch(null, false,new ComponentName(this, DummyActivity.class), null, false);<br \/> return true; } return false; }\n<br \/><br \/><\/code><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In the manifest the dummy activity was associated with the new searchable2.xml: In &#8216;MainActivity&#8217; I overrode &#8216;onSearchRequested()&#8217; to reference the appropriate searchable activity: public boolean onSearchRequested() { SearchManager searchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE); if(searchManager!=null) { \/\/ start the search with the appropriate searchable activity \/\/ so we get the correct search hint in the search dialog if(\/* [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4536","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4536"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4536\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}