Skip to content

Commit 18c2045

Browse files
scottamainAndroid (Google) Code Review
authored andcommitted
Merge "revise info on Search button availability... behavior not guaranteed either bug: 6966922" into jb-dev
2 parents 71c4fc8 + 911711f commit 18c2045

File tree

2 files changed

+30
-42
lines changed

2 files changed

+30
-42
lines changed

docs/html/guide/topics/search/index.jd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ search your data. To perform a search, you need to use APIs appropriate for your
5454
if your data is stored in an SQLite database, you should use the {@link android.database.sqlite}
5555
APIs to perform searches.
5656
<br/><br/>
57-
Also, there is no guarantee that every device provides a dedicated SEARCH button to invoke the
57+
Also, there is no guarantee that a device provides a dedicated SEARCH button that invokes the
5858
search interface in your application. When using the search dialog or a custom interface, you
59-
must always provide a search button in your UI that activates the search interface. For more
59+
must provide a search button in your UI that activates the search interface. For more
6060
information, see <a href="search-dialog.html#InvokingTheSearchDialog">Invoking the search
6161
dialog</a>.</p>
6262

docs/html/guide/topics/search/search-dialog.jd

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ parent.link=index.html
66
<div id="qv-wrapper">
77
<div id="qv">
88

9-
<h2>Quickview</h2>
10-
<ul>
11-
<li>The Android system sends search queries from the search dialog or widget to an activity you
12-
specify to perform searches and present results</li>
13-
<li>You can put the search widget in the Action Bar, as an "action view," for quick
14-
access</li>
15-
</ul>
16-
179

1810
<h2>In this document</h2>
1911
<ol>
@@ -61,14 +53,8 @@ Dictionary</a></li>
6153

6254
<h2>Downloads</h2>
6355
<ol>
64-
<li><a href="{@docRoot}shareables/search_icons.zip">search_icons.zip</a></li>
65-
</ol>
66-
67-
<h2>See also</h2>
68-
<ol>
69-
<li><a href="adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
70-
<li><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
71-
<li><a href="searchable-config.html">Searchable Configuration</a></li>
56+
<li><a href="{@docRoot}design/downloads/index.html#action-bar-icon-pack">Action Bar
57+
Icon Pack</a></li>
7258
</ol>
7359

7460
</div>
@@ -142,12 +128,14 @@ data, and displays the search results.</p></li>
142128
<li>A search interface, provided by either:
143129
<ul>
144130
<li>The search dialog
145-
<p>By default, the search dialog is hidden, but appears at the top of the screen when the
146-
user presses the device SEARCH button (when available) or another button in your user interface.</p>
131+
<p>By default, the search dialog is hidden, but appears at the top of the screen when
132+
you call {@link android.app.Activity#onSearchRequested()} (when the user presses your
133+
Search button).</p>
147134
</li>
148135
<li>Or, a {@link android.widget.SearchView} widget
149136
<p>Using the search widget allows you to put the search box anywhere in your activity.
150-
Instead of putting it in your activity layout, however, it's usually more convenient for users as an
137+
Instead of putting it in your activity layout, you should usually use
138+
{@link android.widget.SearchView} as an
151139
<a href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view in the Action Bar</a>.</p>
152140
</li>
153141
</ul>
@@ -415,10 +403,9 @@ searchable activity that performs the search. However, if you are developing
415403
your application for devices running Android 3.0, you should consider using the search widget
416404
instead (see the side box).</p>
417405

418-
<p>The search dialog is always hidden by default, until the user activates it. If the user's device
419-
includes a SEARCH button, pressing it will activate the search dialog by default. Your application
420-
can also activate the search dialog on demand by calling {@link
421-
android.app.Activity#onSearchRequested onSearchRequested()}. However, neither of these work
406+
<p>The search dialog is always hidden by default, until the user activates it. Your application
407+
can activate the search dialog by calling {@link
408+
android.app.Activity#onSearchRequested onSearchRequested()}. However, this method doesn't work
422409
until you enable the search dialog for the activity.</p>
423410

424411
<p>To enable the search dialog, you must indicate to the system which searchable activity should
@@ -469,8 +456,8 @@ search dialog:</p>
469456
href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
470457
element to declare which searchable activity to use for searches, the activity has enabled the
471458
search dialog.
472-
While the user is in this activity, the device SEARCH button (if available) and the {@link
473-
android.app.Activity#onSearchRequested onSearchRequested()} method will activate the search dialog.
459+
While the user is in this activity, the {@link
460+
android.app.Activity#onSearchRequested onSearchRequested()} method activates the search dialog.
474461
When the user executes the search, the system starts {@code SearchableActivity} and delivers it
475462
the {@link android.content.Intent#ACTION_SEARCH} intent.</p>
476463

@@ -495,21 +482,22 @@ searches.</p>
495482

496483
<h3 id="InvokingTheSearchDialog">Invoking the search dialog</h3>
497484

498-
<p>As mentioned above, the device SEARCH button will open the search dialog as long as the current
499-
activity has declared in the manifest the searchable activity to use.</p>
500-
501-
<p>However, some devices do not include a dedicated SEARCH button, so you should not assume that
502-
it's always available. When using the search dialog, you must <strong>always provide another search
503-
button in your UI</strong> that activates the search dialog by calling {@link
504-
android.app.Activity#onSearchRequested()}.</p>
505-
506-
<p>For instance, you should either provide a menu item in your <a
507-
href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or a button in your
508-
activity layout that
509-
activates search by calling {@link android.app.Activity#onSearchRequested()}. The <a
510-
href="{@docRoot}shareables/search_icons.zip">search_icons.zip</a> file includes icons for
511-
medium and high density screens, which you can use for your search menu item or button (low-density
512-
screens scale-down the hdpi image by one half). </p>
485+
<p>Although some devices provide a dedicated Search button, the behavior of the button may vary
486+
between devices and many devices do not provide a Search button at all. So when using the search
487+
dialog, you <strong>must provide a search button in your UI</strong> that activates the search
488+
dialog by calling {@link android.app.Activity#onSearchRequested()}.</p>
489+
490+
<p>For instance, you should add a Search button in your <a
491+
href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or UI
492+
layout that calls {@link android.app.Activity#onSearchRequested()}. For consistency with
493+
the Android system and other apps, you should label your button with the Android Search icon that's
494+
available from the <a href="{@docRoot}design/downloads/index.html#action-bar-icon-pack">Action Bar
495+
Icon Pack</a>.</p>
496+
497+
<p class="note"><strong>Note:</strong> If your app uses the <a
498+
href="{@docRoot}guide/topics/ui/actionbar.html">action bar</a>, then you should not use
499+
the search dialog for your search interface. Instead, use the <a href="#UsingSearchWidget">search
500+
widget</a> as a collapsible view in the action bar.</p>
513501

514502
<p>You can also enable "type-to-search" functionality, which activates the search dialog when the
515503
user starts typing on the keyboard&mdash;the keystrokes are inserted into the search dialog. You can

0 commit comments

Comments
 (0)