Radoslav Yordanov
Radoslav Yordanov

Reputation: 735

SearchView voice listener

I would like to know if it is possible to set voice listener on my searchView, like the suggestion listener: http://developer.android.com/reference/android/support/v7/widget/SearchView.OnSuggestionListener.html

I want to overwrite the default behavior. I don't want to launch another activity. I just want to get the recorded voice as a string and use it.

Upvotes: 6

Views: 1144

Answers (2)

aaronvargas
aaronvargas

Reputation: 14152

To show the microphone icon you need to add a search configuration and set it to your SearchView. See this question and my answer here https://stackoverflow.com/a/48527608/114549

Upvotes: 1

yakobom
yakobom

Reputation: 2711

I read what you ask for, but Why don't you want to use an activity? Just in case this can help you, you should take a look at these if you havn't till now:

Andriod developers: http://developer.android.com/guide/topics/search/search-dialog.html#VoiceSearch

Examples:

http://www.codeproject.com/Articles/821839/A-Beginners-Guide-to-Working-With-Speech-and-Audio http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/

Hope it helps, yakobom

Upvotes: 1

Related Questions