I would like to start MyActivity
class when the user clicks on the search button on the handset.
Are there any strategies you can suggest for this? Any code examples would be very useful.
I would like to start MyActivity
class when the user clicks on the search button on the handset.
Are there any strategies you can suggest for this? Any code examples would be very useful.
There are two places you can consider:
onKeyUp(int keyCode, KeyEvent event)
, and check keyCode == KeyEvent.KEYCODE_SEARCH
searchable.xml
API which can be exposed by using an android.intent.action.SEARCH
intent-filter. This is forwards compatible, so is probably better if you are constrained to this version of the API. There is a compare/contrast document.This is probably not what you're looking for directly, but I think should help solve the problem you're trying to solve.