How to get input from searchview to textview

Is there any other way to get the searchview tab and put it in a textview? The getText () and setText () methods do not seem to apply to searchview.

or

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

Please help me find the necessary resources / codes / method on the above issue. Thanks. 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 differently. Here:

 tvInput = (TextView) findViewById (R.id.tvInput); tvInput.setText(searchView.getQuery()); 
+8
android searchview
source share
1 answer

for search in editText

 editText.setText(searchView.getQuery()); 

for editText for SearchView

 searchView.setQuery(editText.getText(),false); 

http://developer.android.com/reference/android/widget/SearchView.html#getQuery ()

http://developer.android.com/reference/android/widget/SearchView.html#setQuery(java.lang.CharSequence,boolean)

+17
source share

All Articles