1

After typing some text in SearchView and closing keyboard the text deletes in SearchView, I want to typed text remain.

Vahan
  • 3,016
  • 3
  • 27
  • 43
  • please explain briefly what you are trying to do? – Ram kiran Pachigolla Aug 28 '12 at 12:23
  • See this: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html and http://stackoverflow.com/questions/3542219/dynamically-update-autocomplete-box-in-android – Shrikant Ballal Aug 28 '12 at 12:34
  • @ Ram kiran, I use SearchView, and I want to search text after typing remain in SearchView, not disappear. – Vahan Aug 28 '12 at 12:35
  • I solve this problem with searchView.setQuery(query,submit) in onCreateOptionsMenu, where query I get from intent. – Vahan Aug 28 '12 at 12:38
  • @Shrikant, thanks, but I think I don't need AutoCompleteTextView. – Vahan Aug 28 '12 at 12:39
  • 2
    (1) In the `onQueryTextSubmit()` of `OnQueryTextListener`, you can save it in a field. (2) Then restore the query using `searchView.setQuery("query text", false);` from the field (by setting a `OnClickListener` on your `SearchView` (see [this](http://stackoverflow.com/a/14809924/1276636)) – Sufian Dec 17 '14 at 10:43

1 Answers1

0

use the getText() method and retrieve the text. Or you can use the OnTextChanged event Listener to retrieve the text as it is typed.

Pradeep Banavara
  • 983
  • 2
  • 11
  • 33