android - onSearchRequested() not activating the search dialog -


my main activity needs invoke search , display search results. search dialog not appear when onsearchrequested() called.

i have found similar questions , followed every detail (i think) apparently have else wrong. here snips of implementation.

parts of androidmanifest.xml

<application     android:label="@string/appname"          android:launchmode="singletop"     ... >      <meta-data        android:name="android.app.default_searchable"       android:value=".main.mainactivity" />      <activity       android:name=".main.mainactivity"       android:launchmode="singletop"        ... >        <intent-filter>         <action android:name="android.intent.action.main" />         <category android:name="android.intent.category.launcher" />       </intent-filter>        <intent-filter>         <action android:name="android.intent.action.search" />       </intent-filter>        <meta-data         android:name="android.app.searchable"         android:resource="@xml/deep_search" />      </activity>     ... </application> 

deep_search.xml

<?xml version="1.0" encoding="utf-8"?> <searchable   xmlns:android="http://schemas.android.com/apk/res/android"   android:label="@string/appname"   android:hint="@string/search_deep_hint" > </searchable> 

parts of mainactivity:

public class mainactivity extends activity implements ... {   @override   protected void onnewintent (intent intent)   {     setintent(intent);     if (intent.action_search.equals(intent.getaction()))     {       string query = intent.getstringextra (searchmanager.query);       // work using string     }   }    @override   public boolean onoptionsitemselected (menuitem item)    {      int selectedid = item.getitemid();     switch (selectedid)     {        case ...:        case r.id.menu_search_deep:           boolean launched = onsearchrequested();           logi ("home page deep searched launched: " + launched); // log shows got here         }         return true;      }    ... } 


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -