Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android start user defined activity on search button pressed @ handset

Tags:

I am using following code to start activity when user pressing search button on the handset

@Override public boolean onKeyUp(int keyCode, KeyEvent event) {     if(keyCode == KeyEvent.KEYCODE_SEARCH){         Util.startActivity(ReviewsDetail.this, KeywordSearch.class);         return false;     }else{         return super.onKeyUp(keyCode, event);      } } 

But here are few issues with it please look at the following image.

When press search button it first show google search box at the top of activity then start activity which i want to start

alt text

When click on the back button displays empty actiivty alt text

like image 220
d-man Avatar asked Dec 16 '09 07:12

d-man


1 Answers

 @Override  public boolean onSearchRequested() {       // your logic here       return false;  // don't go ahead and show the search box  } 
like image 120
David Hedlund Avatar answered Oct 09 '22 11:10

David Hedlund