Hello i am using android 3.0 search widget(not the search mode), the problem is i need to pass some parameters along with the search word.
Android i
you can use the follow
in Menu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_al_ayats, menu);
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView =
(SearchView) menu.findItem(R.id.action_search).getActionView();
Bundle appData = new Bundle();
appData.putString("hello", "world");
searchView.setAppSearchData(appData);
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
return true;
}
and in your search result activity put the below
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity_search_result);
handleIntent(getIntent());
}
private void handleIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String extrastring=intent.getBundleExtra(SearchManager.APP_DATA).getString("hello");
//use the query to search your data somehow
getSupportActionBar().setTitle(extrastring);
}
}