/// <summary>Constructs an intent from the given information and the search dialog state. /// </summary> /// <remarks>Constructs an intent from the given information and the search dialog state. /// </remarks> /// <param name="action">Intent action.</param> /// <param name="data">Intent data, or <code>null</code>.</param> /// <param name="extraData"> /// Data for /// <see cref="android.app.SearchManager.EXTRA_DATA_KEY">android.app.SearchManager.EXTRA_DATA_KEY /// </see> /// or <code>null</code>. /// </param> /// <param name="query">Intent query, or <code>null</code>.</param> /// <param name="actionKey"> /// The key code of the action key that was pressed, /// or /// <see cref="android.view.KeyEvent.KEYCODE_UNKNOWN">android.view.KeyEvent.KEYCODE_UNKNOWN /// </see> /// if none. /// </param> /// <param name="actionMsg"> /// The message for the action key that was pressed, /// or <code>null</code> if none. /// </param> /// <param name="mode"> /// The search mode, one of the acceptable values for /// <see cref="android.app.SearchManager.SEARCH_MODE">android.app.SearchManager.SEARCH_MODE /// </see> /// , or /// <code>null</code> /// . /// </param> /// <returns>The intent.</returns> private android.content.Intent createIntent(string action, System.Uri data, string extraData, string query, int actionKey, string actionMsg) { // Now build the Intent android.content.Intent intent = new android.content.Intent(action); intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other activities // on top of the one we want. We don't want to do this in in-app search though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(android.app.SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(android.app.SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(android.app.SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(android.app.SearchManager.APP_DATA, mAppSearchData); } if (actionKey != android.view.KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(android.app.SearchManager.ACTION_KEY, actionKey); intent.putExtra(android.app.SearchManager.ACTION_MSG, actionMsg); } intent.setComponent(mSearchable.getSearchActivity()); return intent; }