Question: I'm using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and click a button i can do the same. But i don't want to use any extra buttons. I just want to display the result when i am pressing enter key.

Answer: 
The right way to solve this is to use **setOnQueryTextListener** 

This is a small exmple using Kotlin:

```
txtSearch = rootView.searchView 
txtSearch.setOnQueryTextListener(object : SearchView.OnQueryTextListener {

        override fun onQueryTextChange(newText: String): Boolean {
            return false
        }

        override fun onQueryTextSubmit(query: String): Boolean {
            return false
        }
 })

```
This is what I have inside the `onCreateOptionsMenu(Menu menu)` function on my main activity:

```
MenuItem searchItem = menu.findItem(R.id.search);
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String query) {
        // Do whatever you need. This will be fired only when submitting.
        return false;
    }

    @Override
    public boolean onQueryTextChange(String newText) {
        // Do whatever you need when text changes. 
        // This will be fired every time you input any character.
        return false;
    }
});

```