Android search dialog not showing

Hi, I'm upset by the search dialog as shown at http://developer.android.com/guide/topics/search/search-dialog.html

The search dialog is not displayed when I click the search button on my device. here is my simple manifest file:

<application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".Main" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="android.app.default_searchable" android:value=".Other" /> </activity> <activity android:name=".Other"> <intent-filter> <action android:name="android.intent.action.SEARCH" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/> </activity> </application> 

My res / xml / searchable.xml is as follows:

 <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="lol" android:hint="search" > </searchable> 

in Main.java onSearchRequested () is started, but the search dialog is not displayed.

Am I missing something?

+6
source share
2 answers

"The android: label attribute is the only required attribute. It points to a string resource, which should be the name of the application. This label is not actually visible to the user until you enable search suggestions for the quick search window. At this point, this label appears in the list of search items in the system settings. "

0
source

To remove a question from an unanswered answer, copy the comment using the solution:

Oh my God. this is stupid. I had to use android: label = "@ string / xyz" instead of android: label = "lol" and no one word about this in the documentation. unbelievably

+1
source

Source: https://habr.com/ru/post/887550/


All Articles