Friday, June 11, 2010

[android-developers] Search suggestions causing inconsistent behavior in application after triggered from Quick Search Bar

I'm running into an issue with the Quick Search Bar that I'm hoping
someone can help me with.

My application includes a Searchable activity used to provide search
behavior within my application. That search activity is designed to
trigger a separate Intent when the search item is clicked on so as to
cause a different Activity to handle the viewing. When used within
the application, the search behavior works perfectly every time.

My application also includes a ContentProvider used to provide search
suggestions and is also configured to allow use in the Quick Search
Bar. When used within the application itself, use of the search
suggestions works fine every time it is used. When triggered from the
QSB, the initial search suggestion brings up the viewing activity just
as it should. After that point, however, any use of the search
suggestions from within the application (i.e. bringing up the search
and selecting a search suggestion) fails to trigger the viewing
application. In fact, I've put debug statements in every single
"onXXX()" method within the Searchable activity and I never see any of
them get triggered. On the flip side, when I trigger a standard
search at that same point (i.e. enter a query string and hit enter,
rather than navigating to a search suggestion), the search dialog
comes up, as expected, and selecting an item from that list
successfully triggers my application.

I'm currently at a loss trying to determine why this would be
occurring. Any ideas

As as some additional information, my manifest contains the following
in regards to the searchable activity
(".activity.SearchableActivity"), the suggestions provider
(".content.TestSuggestionProvider") and the activity used to display
the content (".activity.TestDisplayActivity"):

<activity
android:name=".activity.TestDisplayActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:finishOnTaskLaunch="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden">
<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=".activity.SearchableActivity" />
</activity>

<activity
android:name=".activity.SearchableActivity"
android:launchMode="singleTop"
android:theme="@android:style/
Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>

<provider
android:name=".content.TestSuggestionProvider"
android:authorities="com.test.provider.suggest"
android:syncable="false"
/>

And the following is the XML used to further define the settings of
the searchable activity:

<searchable xmlns:android="http://schemas.android.com/apk/res/
android"
android:label="@string/search_app_label"
android:hint="@string/search_app_hint"
android:searchSettingsDescription="@string/
search_app_settings_description"
android:includeInGlobalSearch="true"
android:voiceSearchMode="showVoiceSearchButton|
launchRecognizer"
android:searchSuggestAuthority="com.test.provider.suggest"

android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>

Any thoughts? At the moment I'm at a complete loss…

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment