Created
February 15, 2011 23:36
-
-
Save lethargicpanda/828526 to your computer and use it in GitHub Desktop.
XML describing the behavior of the android search dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application ... > | |
<activity android:name=".MainSearchableActivity" > | |
<intent-filter> | |
<action android:name="android.intent.action.SEARCH" /> | |
</intent-filter> | |
<meta-data android:name="android.app.searchable" | |
android:resource="@xml/searchable"/> | |
</activity> | |
... | |
</application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
public void onCreate(Bundle savedInstanceState) { | |
[...] | |
Intent intent = getIntent(); | |
if (Intent.ACTION_SEARCH.equals(intent.getAction())) { | |
String query = intent.getStringExtra(SearchManager.QUERY); | |
doMySearch(query); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<searchable xmlns:android="http://schemas.android.com/apk/res/android" | |
android:label="@string/app_label" | |
android:hint="Search in your_application_name" > | |
</searchable> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snippets used to implement the Android Search Dialog
http://developer.android.com/guide/topics/search/search-dialog.html