你好我使用的是Android 3.0的search部件 (不是search模式),问题是我需要传递一些参数,随着search词。


searchManager.setOnDismissListener( new OnDismissListener() { @Override public void onDismiss() { // TODO Auto-generated method stub Log.v(MyApp.TAG, "on dismiss search"); } }); searchManager.setOnCancelListener( new OnCancelListener() { @Override public void onCancel() { // TODO Auto-generated method stub Log.v(MyApp.TAG, "on dismiss cancel"); } }); @Override public boolean onSearchRequested() { Bundle appData = new Bundle(); appData.putLong("listino_id", this.listino_id); this.startSearch(null, true, appData, false); return true; // return super.onSearchRequested(); } 

我需要我的活动不是 singleOnTop,这里是我的AndroidManifest.xml

  <activity android:name=".activity.ListinoProdottiActivity" android:windowSoftInputMode="stateHidden"> <!-- Receives the search request. --> <intent-filter> <action android:name="android.intent.action.SEARCH" /> <!-- No category needed, because the Intent will specify this class component--> </intent-filter> <!-- enable the base activity to send searches to itself --> <meta-data android:name="" android:value=".activity.ListinoProdottiActivity" /> <!-- Points to searchable meta data. --> <meta-data android:name="" android:resource="@xml/searchable" /> </activity> 


 <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="" android:label="@string/app_name" /> 

Related of "androidsearch传递包"