How to get input from searchview to textview

Viewed 22602

Is there another way to get the input of searchview and put it into textview? It seems that the getText() and setText() method are not applicable to searchview.

Or

Is there a way to transfer the input from EditText to Searchview?

Please help me to look for necessary resources/codes/method about the above question. Thank you. Here is my code:

public boolean onQueryTextChange(String newText) {
    // TODO Auto-generated method stub
    showResults(newText);
    return false;
}

@Override
public boolean onQueryTextSubmit(String query) {
    // TODO Auto-generated method stub

    tvInput = (TextView) findViewById (R.id.tvInput);
    showResults(query);
//  searchView.getQuery().toString();
    tvInput.setText(searchView.getQuery().toString());
    return false;
}

I also do it in other way. Here:

tvInput = (TextView) findViewById (R.id.tvInput);
                tvInput.setText(searchView.getQuery());
1 Answers
Related