How to add search function code used for "search bar" inside Onclick of "search button" in android

view story

http://stackoverflow.com – I have 2 activities, in 1st activity there is an "keyword" and "search" button, based on the keyword given related items should be displayed in the second activity in listview form, but just to test i hv placed search bar on top of the listview and coded for it, and this works fine, now the issue s i want to move "search function code" in 2nd activity inside onclick of "search" button. here's my code @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); StrictMode.ThreadPolicy policy = new StrictMode.Thre (HowTos)