How to open the search by clicking a custom button in android? -
i want open search (default search), stays on desktop (the google search) clicking button.
here xml code:
<imagebutton android:id="@+id/btnsearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_action_search" android:text="" />
which used create button. it's simple button. used onclicklistener
catch click event of button :
imgsearch.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { onsearchrequested(); } } );
but couldn't find out how make work. please let me know do.
you can use intent
class web search action:
private void onsearchrequested() { intent intent = new intent(intent.action_web_search); intent.putextra(searchmanager.query, "your search query"); startactivity(intent); }
Comments
Post a Comment