SearchView voice listener - java

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.

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

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

Related

Android - Perform an action with voice command

Searched through the internet and couldn't find a god example of achieving the following. There is a Launcher activity. User will be navigated to the launcher activity first and inside that activity , when the user says a certain word like "Start" or something like that the app should navigate the user to another activity. I've gone through a set of tutorials , and I've seen some similar questions at SO but none of them make sense to me. What will be the best approach to achieve this ?
Basically what you have to do is
build a framework/module to handle Speech Input (speech-2-text)
Depending on Input by user, perform an action

WhatsApp's new quick reply option, How it works?

I'm trying to get a text input from the user after he clicks a notification action button.
The problem is that I'm using a custom notification layout so the button is implemented by RemoteView and not by Notification.Action class, so I can't use RemoteInput.
So I was thinking to do something like WhatsApp's new quick reply option but I can't figure out how they have managed to do it...
Any ideas about that?
Any help will be appreciated!
Thank ahead

Edittext text input listener

Am developing an android chat application. Everything works well but except for one thing; I want to set the visibility of a layout to gone and then set a different layout to visible when user starts typing in the edittext like the one implemented on whatsapp.
But I cant seem to figure it out.
Any help will be appreciated
Basically, what I want to do is set the visibility of a layout which contains an image button to upload image to gone and then show a layout which contains an image button to send the message or text in the edittext to visible when the user starts typing
Can you explain in detail?
Do you wan edit text to come up when keyboard is hoped up.
then use below in your manifest.
<activity
android:name=".Activityname"
android:windowSoftInputMode="adjustPan">
If not, then please explain your question in more detail
Take a look at the TextChangedListener. With help of the TextWatcher you should be able to run commands when the input changes.
Please describe in more detail, if you need further assistance.

Android: onConnectionToInternet

I want to know if there any listener, like onClickListener , but for connection to the Internet. I want to start some function, only when there is a new connection to Internet.
Exactly like a Button, that till it is not pressed, it's not start the onClick.
Does someone know something like that?
Thanks in advance!
Check out BROADCAST RECIEVER
What happens is as soon if a change in network ex:Internet, android
fires an intent
You can use this Intent as per your wish to achieve your objective,
like performing some tasks
You can place the Broadcast reciever in your main activity
Don't forget to declare it in manifest
CHECK THIS STACKOVERFLOW POST- IT WILL GIVE YOU THE IDEA ON HOW TO USE
Hope this helps !, comment back if you need any more information

Is there a keypad widget for Android?

I'm working on a checkbook app, and I'd like to use a small widget like a TimePickerDialog or DatePickerDialog but one that acts like a keypad so the user can enter an account or transaction balance. I know I can use an EditText but I would like to be able to implement a keypad.
Does Android have any predefined UI elements to support this? I have tried to find some, but without luck. I did find an interesting article to implement my own using a GridLayout, but wondered if someone was aware of any Android classes that could already do this.
The GridLayout method: http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout--mobile-8677
If you specify android:inputType="numberDecimal" in the XML for your EditText, you'll get a keypad. If you decide that you need a more specialized keyboard, there's a very good tutorial here.
Some tips:
Read this tutorial: Creating an Input Method
Clone this repo: LatinIME

Categories

Resources