[Solved] How to open new activity after clicking list view with search bar element?


You can search on a listview and you can use OnItemClickListener

From search view

new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextChange(String newText) {
        if (TextUtils.isEmpty(newText)) {
        mListView.clearTextFilter();
    } else {
        mListView.setFilterText(newText.toString()); //you can use this to filter items
    }
    return true;
    }

    @Override
    public boolean onQueryTextSubmit(String query) {
        return true;
    }
}

And in Listview

mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                //put some intent 
            }
        }

For going to new Activity use this

Intent intent=new Intent(getBaseContext(),TargetActivity.class);
startActivity(intent);

refer

  1. http://www.coderzheaven.com/2013/06/01/create-searchview-filter-mode-listview-android/

  2. https://stackoverflow.com/a/5714068/5962715

solved How to open new activity after clicking list view with search bar element?