1
00:00:00,350 --> 00:00:01,260
Hired Yvonne.

2
00:00:01,300 --> 00:00:07,740
So now in this tutorial we're going to go ahead and we're going to actually put a button here in order

3
00:00:07,740 --> 00:00:15,240
to allow the user to actually talk to the phone to actually open that voice intent and allow the user

4
00:00:15,240 --> 00:00:18,170
to talk to their phone over and over again.

5
00:00:18,210 --> 00:00:20,900
First of all let's change the background color of these.

6
00:00:20,910 --> 00:00:22,480
Lay out this relatively.

7
00:00:22,740 --> 00:00:25,910
So here just look at this composite componentry here.

8
00:00:25,920 --> 00:00:32,380
Select selectees relatively out and here inside this property section click on View all properties.

9
00:00:32,680 --> 00:00:36,360
And let's take a look at this back an attribute here.

10
00:00:36,390 --> 00:00:40,570
So for the packaging an attribute for the value for the value just gave in here.

11
00:00:40,580 --> 00:00:41,640
Hash tag.

12
00:00:42,030 --> 00:00:45,960
And you know that we have our G-B colors right.

13
00:00:45,960 --> 00:00:47,530
Or is for it.

14
00:00:47,550 --> 00:00:52,850
So I want to write you zero here and we have g for the clean.

15
00:00:53,190 --> 00:00:57,540
So I want to value 9 here and we have de-value blue again zero.

16
00:00:57,540 --> 00:00:59,920
So let's press on and then channel keyboard.

17
00:00:59,940 --> 00:01:06,030
So now we can see that the background color of are relatively out is actually clean right.

18
00:01:06,150 --> 00:01:07,180
So that's it.

19
00:01:07,230 --> 00:01:14,440
Let's actually now let's write about in here into this relatively inside this linearly or actually.

20
00:01:14,460 --> 00:01:20,250
So take a look at this Pelet section click on all and select the spot in and just drag it and put it

21
00:01:20,250 --> 00:01:20,980
here below.

22
00:01:21,060 --> 00:01:22,200
This takes you inside.

23
00:01:22,230 --> 00:01:24,430
Inside is linearly as vertical.

24
00:01:24,600 --> 00:01:26,550
Inside these componentry section here.

25
00:01:26,760 --> 00:01:29,320
So now you can see that you have this button here.

26
00:01:29,340 --> 00:01:34,040
So select this button and let's change the ID of this button.

27
00:01:34,050 --> 00:01:42,560
So for the idea attribute to save in here Pythian voice PTEN voice intent and then present into the

28
00:01:42,560 --> 00:01:50,540
Chanute keyboard and lets for the text that should be changed the text of the spot and here to talk

29
00:01:50,540 --> 00:01:51,550
to the touch.

30
00:01:52,570 --> 00:01:53,310
To the phone.

31
00:01:54,900 --> 00:01:55,370
Right.

32
00:01:55,590 --> 00:02:00,510
And then let's put this exclamation point here and the person entity on your keyboard.

33
00:02:00,510 --> 00:02:01,290
So that's it.

34
00:02:01,560 --> 00:02:05,490
Let's go to our main activity class here let's scroll to the top here.

35
00:02:05,490 --> 00:02:08,630
Now let's actually declare a variable of take part in.

36
00:02:08,760 --> 00:02:17,600
So just typing here Potten PTEN voice intent between voice Pythian underlined voice intent BT and underline

37
00:02:17,720 --> 00:02:19,270
voice semicolon.

38
00:02:19,490 --> 00:02:20,860
So let's scroll down here.

39
00:02:20,880 --> 00:02:22,870
Let's go inside this uncreate Mefford.

40
00:02:23,210 --> 00:02:28,910
And after this line of code that actually initializers this takes the value here let's say Pythian voice

41
00:02:28,970 --> 00:02:37,870
intent assignment operator and let's actually test this object to a button object find view by ID are

42
00:02:37,910 --> 00:02:39,080
thought Id cards.

43
00:02:39,110 --> 00:02:41,650
PTEN voice intent semicolon.

44
00:02:41,720 --> 00:02:42,590
That's it.

45
00:02:42,590 --> 00:02:49,460
So let's now actually say that let's create a listener for this spot and we can actually create an anonymous

46
00:02:49,460 --> 00:02:50,840
in a class here.

47
00:02:50,840 --> 00:02:58,200
But it's actually more cleaner to say that this class main activity is conforming to that view that

48
00:02:58,240 --> 00:03:03,410
Uncle listener interface and that we can override the uncle effect here inside this class.

49
00:03:03,500 --> 00:03:08,190
So let's create a new line here inside these uncreate and if at let's say between voice intent that

50
00:03:08,210 --> 00:03:15,200
set unclick listener sit on click listener and let's pass the context which is going to be the main

51
00:03:15,200 --> 00:03:16,400
activity that this.

52
00:03:16,700 --> 00:03:17,930
So analysis scroll to the top.

53
00:03:17,930 --> 00:03:21,820
And now this class must implement the view that Uncle's class and an interface.

54
00:03:21,830 --> 00:03:29,580
So let's say public class activity extends our compact activity implements view that unclick listener

55
00:03:29,750 --> 00:03:31,450
you that uncle or interface.

56
00:03:31,670 --> 00:03:36,380
So now we need to overwrite the up until we came over here let's scroll down here and now before the

57
00:03:36,380 --> 00:03:39,790
end in Kerley place let's actually go back to our main activity class.

58
00:03:39,800 --> 00:03:40,490
Excuse me.

59
00:03:40,490 --> 00:03:46,660
So now before the ending calibers of this class main activity just open here on click.

60
00:03:47,060 --> 00:03:47,670
Right.

61
00:03:47,750 --> 00:03:48,200
That's it.

62
00:03:48,240 --> 00:03:53,410
Now this is our method unclick Let's change the name of this argument to you is more meaningful.

63
00:03:53,630 --> 00:03:56,030
So now insight is Smurfette here.

64
00:03:56,090 --> 00:04:00,580
So you know that whenever they use it interacts with this button let's go to all my activity on I mean

65
00:04:00,590 --> 00:04:06,120
it every minute segment here whenever the user actually interacts with the spot and to the phone.

66
00:04:06,130 --> 00:04:09,320
This server here unclick is going to be executed.

67
00:04:09,380 --> 00:04:16,310
So here I can just say listen to the users voice that said we are calling this method here.

68
00:04:16,310 --> 00:04:23,900
So whenever they use that actually clicks or touches this button here then the invoice content is going

69
00:04:23,900 --> 00:04:26,610
to be opened and the user can actually talk to the phone.

70
00:04:26,750 --> 00:04:28,240
So let's run the app.

71
00:04:28,250 --> 00:04:33,620
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

72
00:04:33,680 --> 00:04:35,440
and then I'm going to show you that.

73
00:04:35,450 --> 00:04:38,330
So let's select our actual device here and then click on OK.

74
00:04:38,450 --> 00:04:45,230
So I tested the app on my Android device and then I actually record that screen of my device so let

75
00:04:45,230 --> 00:04:52,170
me actually play the video for you here so I said hello and now and you can see this value besides Hello

76
00:04:52,190 --> 00:04:53,860
this is actually a confit level.

77
00:04:53,900 --> 00:04:54,190
Right.

78
00:04:54,190 --> 00:04:59,090
The confidence level of these Hello takes here this work actually.

79
00:04:59,300 --> 00:05:03,460
So you are already familiar with this value of it how wide this value is here.

80
00:05:03,470 --> 00:05:09,320
Because here this is called confidence level and confidence level is the level or the value that actually

81
00:05:09,320 --> 00:05:13,200
specifies how accurate is our vault here.

82
00:05:13,250 --> 00:05:14,200
Right.

83
00:05:14,360 --> 00:05:18,860
So this is that level here and then I'm going to let me play with you again.

84
00:05:18,860 --> 00:05:24,340
So here I actually pressed on touching the button and then it's going actually opened this voice intent

85
00:05:24,350 --> 00:05:25,840
for me and here I said hi.

86
00:05:25,880 --> 00:05:32,030
So you can see this value here and again I said something else and now you can see this value here and

87
00:05:32,030 --> 00:05:33,460
this confidence level here.

88
00:05:33,680 --> 00:05:36,390
So now you can see that our application works fine.

89
00:05:36,740 --> 00:05:40,370
So make sure to test this up on your Android device.

90
00:05:40,550 --> 00:05:45,650
And if you have any questions please post the discussion in the course and then I'll do my best to answer

91
00:05:45,680 --> 00:05:47,460
all of your questions.

92
00:05:47,480 --> 00:05:53,060
So here let me tell you that if you want to actually use this voice and if you want to use the speech

93
00:05:53,060 --> 00:05:58,450
recognition framework in Android you your device must be connected to the Internet.

94
00:05:58,460 --> 00:06:03,380
You must have an internet connection because if you don't have an Internet connection you can actually

95
00:06:03,380 --> 00:06:06,500
use the voice recognition framework in Android.

96
00:06:06,530 --> 00:06:10,520
So make sure that your device is actually connected to the Internet and then you can test this feature

97
00:06:10,520 --> 00:06:11,880
on your Android device.

