How Can I Call Search Dialog On Button Click In Android?
I am making a small application where I have to call search dialog on search button click please give me simple code or simple tutorial because I have seen many example but I am no
Solution 1:
Override search button as :
@OverridepublicbooleanonKeyUp(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_SEARCH){
//do, what you want
}
}
Solution 2:
UPDATE: (since we're talking about the hardware button)
Declare a searchable configuration: http://developer.android.com/guide/topics/search/searchable-config.html. There is an example at the bottom of the linked page.
Then create a searchable activity: http://developer.android.com/guide/topics/search/search-dialog.html#SearchableActivity
And then, for any activity that should react to the search button being pressed, do this: http://developer.android.com/guide/topics/search/search-dialog.html#SearchDialog
Post a Comment for "How Can I Call Search Dialog On Button Click In Android?"