Hired Yvonne.
So now in this tutorial we're going to go ahead and we're going to actually put a button here in order
to allow the user to actually talk to the phone to actually open that voice intent and allow the user
to talk to their phone over and over again.
First of all let's change the background color of these.
Lay out this relatively.
So here just look at this composite componentry here.
Select selectees relatively out and here inside this property section click on View all properties.
And let's take a look at this back an attribute here.
So for the packaging an attribute for the value for the value just gave in here.
Hash tag.
And you know that we have our G-B colors right.
Or is for it.
So I want to write you zero here and we have g for the clean.
So I want to value 9 here and we have de-value blue again zero.
So let's press on and then channel keyboard.
So now we can see that the background color of are relatively out is actually clean right.
So that's it.
Let's actually now let's write about in here into this relatively inside this linearly or actually.
So take a look at this Pelet section click on all and select the spot in and just drag it and put it
here below.
This takes you inside.
Inside is linearly as vertical.
Inside these componentry section here.
So now you can see that you have this button here.
So select this button and let's change the ID of this button.
So for the idea attribute to save in here Pythian voice PTEN voice intent and then present into the
Chanute keyboard and lets for the text that should be changed the text of the spot and here to talk
to the touch.
To the phone.
Right.
And then let's put this exclamation point here and the person entity on your keyboard.
So that's it.
Let's go to our main activity class here let's scroll to the top here.
Now let's actually declare a variable of take part in.
So just typing here Potten PTEN voice intent between voice Pythian underlined voice intent BT and underline
voice semicolon.
So let's scroll down here.
Let's go inside this uncreate Mefford.
And after this line of code that actually initializers this takes the value here let's say Pythian voice
intent assignment operator and let's actually test this object to a button object find view by ID are
thought Id cards.
PTEN voice intent semicolon.
That's it.
So let's now actually say that let's create a listener for this spot and we can actually create an anonymous
in a class here.
But it's actually more cleaner to say that this class main activity is conforming to that view that
Uncle listener interface and that we can override the uncle effect here inside this class.
So let's create a new line here inside these uncreate and if at let's say between voice intent that
set unclick listener sit on click listener and let's pass the context which is going to be the main
activity that this.
So analysis scroll to the top.
And now this class must implement the view that Uncle's class and an interface.
So let's say public class activity extends our compact activity implements view that unclick listener
you that uncle or interface.
So now we need to overwrite the up until we came over here let's scroll down here and now before the
end in Kerley place let's actually go back to our main activity class.
Excuse me.
So now before the ending calibers of this class main activity just open here on click.
Right.
That's it.
Now this is our method unclick Let's change the name of this argument to you is more meaningful.
So now insight is Smurfette here.
So you know that whenever they use it interacts with this button let's go to all my activity on I mean
it every minute segment here whenever the user actually interacts with the spot and to the phone.
This server here unclick is going to be executed.
So here I can just say listen to the users voice that said we are calling this method here.
So whenever they use that actually clicks or touches this button here then the invoice content is going
to be opened and the user can actually talk to the phone.
So let's run the app.
Now I'm going to run the app on my actual device and then I'm going to be caught my voice my phone screen
and then I'm going to show you that.
So let's select our actual device here and then click on OK.
So I tested the app on my Android device and then I actually record that screen of my device so let
me actually play the video for you here so I said hello and now and you can see this value besides Hello
this is actually a confit level.
Right.
The confidence level of these Hello takes here this work actually.
So you are already familiar with this value of it how wide this value is here.
Because here this is called confidence level and confidence level is the level or the value that actually
specifies how accurate is our vault here.
Right.
So this is that level here and then I'm going to let me play with you again.
So here I actually pressed on touching the button and then it's going actually opened this voice intent
for me and here I said hi.
So you can see this value here and again I said something else and now you can see this value here and
this confidence level here.
So now you can see that our application works fine.
So make sure to test this up on your Android device.
And if you have any questions please post the discussion in the course and then I'll do my best to answer
all of your questions.
So here let me tell you that if you want to actually use this voice and if you want to use the speech
recognition framework in Android you your device must be connected to the Internet.
You must have an internet connection because if you don't have an Internet connection you can actually
use the voice recognition framework in Android.
So make sure that your device is actually connected to the Internet and then you can test this feature
on your Android device.