1
00:00:00,450 --> 00:00:07,260
So now let's actually go to our Android studio and here let me actually double click on this tab here

2
00:00:07,260 --> 00:00:09,570
in order to make this area wider here.

3
00:00:09,840 --> 00:00:13,710
So now I want to actually get the value of this key.

4
00:00:13,710 --> 00:00:17,740
Let's go to our web browser and here we have the school here right.

5
00:00:17,760 --> 00:00:20,180
So let's change this value here to for example.

6
00:00:20,180 --> 00:00:25,570
This is a value to and here as you can see I changed the value of this key.

7
00:00:25,590 --> 00:00:26,180
Right.

8
00:00:26,220 --> 00:00:29,010
So now I want to get the value of this key.

9
00:00:29,010 --> 00:00:35,050
So let's go back to an android studio and now here.

10
00:00:35,050 --> 00:00:40,930
After the end in apprentices of this the listener here at value listener for this key as you can see

11
00:00:41,160 --> 00:00:44,470
I want to actually create an orderly center for another key.

12
00:00:44,470 --> 00:00:45,140
Right.

13
00:00:45,190 --> 00:00:51,670
So now here still I am actually inside this uncle listen at here Uncle unclick my fate here as you can

14
00:00:51,670 --> 00:00:52,290
see.

15
00:00:52,600 --> 00:00:56,370
And now this block of code here is actually related to Diski.

16
00:00:56,440 --> 00:01:01,940
I created actually an add value listener for this key right.

17
00:01:02,110 --> 00:01:07,780
So now I want to actually create another add value listener for another key.

18
00:01:07,780 --> 00:01:16,240
So after the end in practice here of this listener as you can see so just typing firebase database firebase

19
00:01:16,240 --> 00:01:20,230
database does get the reference.

20
00:01:20,290 --> 00:01:23,740
And now I need to specify the reference so inside the double quotes.

21
00:01:23,740 --> 00:01:26,340
Let's actually go back to our web browser here.

22
00:01:26,350 --> 00:01:27,930
As you can see we have this here.

23
00:01:28,000 --> 00:01:33,370
So just select this key here as you can see this is our key right here you can enter the cockpit is

24
00:01:33,370 --> 00:01:33,840
key.

25
00:01:34,000 --> 00:01:41,320
So just highlighted here and then just right click on it and then click on copy.

26
00:01:41,320 --> 00:01:46,200
So now that I actually copy this key here let's actually just click on this link here.

27
00:01:46,210 --> 00:01:48,940
In order to see the whole database here.

28
00:01:48,970 --> 00:01:50,630
So let's go back to Andrew with you.

29
00:01:50,770 --> 00:01:53,900
And now I can actually paste that key here.

30
00:01:54,160 --> 00:01:54,650
Right.

31
00:01:54,850 --> 00:02:00,840
And here I can say that as you can see here adds value in it.

32
00:02:00,850 --> 00:02:07,520
So now let me actually create a new line here and here I can say that add value event listener.

33
00:02:07,570 --> 00:02:14,590
Right person until you on your keyboard and then just put the new key word here and then hold the shift

34
00:02:14,590 --> 00:02:15,480
key on your keyboard.

35
00:02:15,520 --> 00:02:23,770
And then just put it like capitalized to the letter here and now you can select this option and in person

36
00:02:23,790 --> 00:02:25,290
it'll be on your keyboard.

37
00:02:25,420 --> 00:02:31,060
And now the autocomplete feature on Android studio is going to put these lines of code here for us.

38
00:02:31,060 --> 00:02:36,460
And then as you can see here we have this error here and we need to put a semi-colon after the end in

39
00:02:36,460 --> 00:02:37,470
Prentice's here.

40
00:02:37,510 --> 00:02:38,100
Right.

41
00:02:38,470 --> 00:02:39,950
And now we have two methods.

42
00:02:39,970 --> 00:02:43,480
The first one is on data change and the second one is uncancel.

43
00:02:43,510 --> 00:02:44,130
Right.

44
00:02:44,170 --> 00:02:52,120
So I told you that this method on data change is going to be called of when ever we actually click on

45
00:02:52,120 --> 00:02:59,070
the spot in get data from server PTEN get data from server and it's going to actually also be called

46
00:02:59,320 --> 00:03:02,500
when ever we change the date of that key.

47
00:03:02,680 --> 00:03:08,110
So for example here as you can see we have this key here right and now if I show you the emulator and

48
00:03:08,110 --> 00:03:13,720
let's actually click on the spot and get data from server as you can see we got this data.

49
00:03:13,720 --> 00:03:15,390
This is a value right.

50
00:03:15,400 --> 00:03:20,660
So now this value is actually the value of this and to the cheat.

51
00:03:20,710 --> 00:03:22,990
So let's actually change this value to another value.

52
00:03:23,000 --> 00:03:24,250
Let's see what happens.

53
00:03:24,490 --> 00:03:32,450
And here I can say for example some value right and then press on intel on your keyboard.

54
00:03:32,590 --> 00:03:36,190
And now as you can see here I changed the value of this key right.

55
00:03:36,190 --> 00:03:41,000
So now this value is also changed inside our emulator some value.

56
00:03:41,410 --> 00:03:48,370
So that on the top change method is actually called an error that you actually change the value of your

57
00:03:48,370 --> 00:03:49,000
key.

58
00:03:49,270 --> 00:03:49,670
Right.

59
00:03:49,750 --> 00:03:52,590
So let's actually change it to another value for example.

60
00:03:53,080 --> 00:04:03,510
We can actually just type in here my value enter and now it says my value as you can see here.

61
00:04:03,520 --> 00:04:05,880
So now let's go back to android studio.

62
00:04:06,070 --> 00:04:10,500
So here I created a listener for this key right for this key.

63
00:04:10,540 --> 00:04:11,550
As you can see here.

64
00:04:11,740 --> 00:04:17,570
So now inside the update or change method as you can see I can just type in here.

65
00:04:17,570 --> 00:04:18,200
Streambed

66
00:04:21,170 --> 00:04:27,860
And here again value assignment operator and here in order to get the data as you can see we have this

67
00:04:27,860 --> 00:04:29,490
argument data snapshot.

68
00:04:29,510 --> 00:04:32,740
So this argument actually holds the value of this key.

69
00:04:33,020 --> 00:04:43,500
So here I can see data snapshot right data snapshot that gets value semi-colon and here I need to specify

70
00:04:43,710 --> 00:04:44,400
the data type.

71
00:04:44,390 --> 00:04:47,460
So inside the practice's I can just say strange thoughts.

72
00:04:47,460 --> 00:04:54,970
Class right now I can just print that value here.

73
00:04:55,070 --> 00:04:57,570
So here let's actually create a log.

74
00:04:57,650 --> 00:04:58,490
So log.

75
00:04:58,560 --> 00:05:00,410
That's right.

76
00:05:01,010 --> 00:05:04,000
And first of all I need to specify that right.

77
00:05:04,040 --> 00:05:13,570
So just put two double quotes here and then just type in here t a g tank comma and then here I can't

78
00:05:13,570 --> 00:05:17,110
put the value here value and then semicolon.

79
00:05:17,110 --> 00:05:26,840
So now let's actually just run our project and now let me actually just show you the web browser and

80
00:05:26,840 --> 00:05:30,270
then let me show you the emulator here.

81
00:05:30,290 --> 00:05:34,190
So now I want to click on the spot and get data from server.

82
00:05:34,240 --> 00:05:36,270
First of all we have this value here right.

83
00:05:36,280 --> 00:05:42,490
But the value of this second key as you can see here is going to be logged here to the console.

84
00:05:42,490 --> 00:05:48,940
So let me show you the Android studio and here at the bottom click on Android monitor and here as you

85
00:05:48,940 --> 00:05:55,660
can see we have this search here the search bar just typing here THG as you can see.

86
00:05:55,810 --> 00:05:59,660
And now as you can see here in the console we have this value.

87
00:05:59,680 --> 00:06:01,260
This is a value to.

88
00:06:01,330 --> 00:06:01,580
Right.

89
00:06:01,570 --> 00:06:03,710
So this is the value of this key.

90
00:06:04,120 --> 00:06:07,000
So here I can just delete this value.

91
00:06:07,060 --> 00:06:12,060
And here I can say this is my own value right.

92
00:06:12,220 --> 00:06:14,400
And that person enter key on your keyboard.

93
00:06:14,760 --> 00:06:19,010
And now if I actually go to Android Studio inside the lug you can see this value.

94
00:06:19,030 --> 00:06:20,410
This is my own value.

95
00:06:20,500 --> 00:06:25,210
So if something in order to actually clear the logjam here you just need to click on the spot in here

96
00:06:25,210 --> 00:06:26,410
right to left right.

97
00:06:26,500 --> 00:06:27,680
Clear like that.

98
00:06:27,970 --> 00:06:30,650
And now as you can see here we have nothing here.

99
00:06:30,790 --> 00:06:32,820
So now let's actually change this value again.

100
00:06:32,830 --> 00:06:35,770
So here I can for example say number 100.

101
00:06:35,950 --> 00:06:38,310
And that person the key on your keyboard.

102
00:06:38,440 --> 00:06:42,710
And now if I go to the live chat here let's see what happens.

103
00:06:42,970 --> 00:06:45,190
So as you can see here nothing happened.

104
00:06:45,190 --> 00:06:46,500
Why.

105
00:06:46,510 --> 00:06:53,880
Because of he said that the value that we are going to get from these key is going to be us think value.

106
00:06:53,890 --> 00:06:55,450
Right.

107
00:06:55,690 --> 00:07:00,430
So now let's see how we can actually get an integer value from the database.

108
00:07:00,450 --> 00:07:04,750
So as you can see here let me show you the web browser as you can see if you have here an integer value

109
00:07:04,750 --> 00:07:05,320
right.

110
00:07:05,320 --> 00:07:09,840
So now I want to get an integer value not and think value right.

111
00:07:09,910 --> 00:07:11,990
So not our string value.

112
00:07:12,010 --> 00:07:18,940
So let's go back to our Android studio and here I can actually create a variable so it and the name

113
00:07:18,940 --> 00:07:19,900
of my variable.

114
00:07:19,900 --> 00:07:23,040
As you can see I am in status on data change method here right.

115
00:07:23,230 --> 00:07:31,540
Inside is Uncle I value listener here for this key so he can say it and the name of my else can be in

116
00:07:31,670 --> 00:07:33,080
value right.

117
00:07:33,340 --> 00:07:34,810
Assignment operator.

118
00:07:35,110 --> 00:07:38,340
And then here I can refer to the name of this data or snapshot here.

119
00:07:38,350 --> 00:07:41,020
This argument does get value.

120
00:07:41,440 --> 00:07:46,830
And inside Apprentice's because this is actually an integer value that you want to get inside Apprentice's

121
00:07:46,840 --> 00:07:49,740
I need to say integer class.

122
00:07:50,080 --> 00:07:54,710
And then at the end of my code at the end of my statement I need to put a semicolon.

123
00:07:55,030 --> 00:07:56,830
And here I can say log.

124
00:07:57,400 --> 00:08:00,880
That's why I'm here for the first argument.

125
00:08:00,880 --> 00:08:03,350
I need to specify the tag which is of type streams.

126
00:08:03,510 --> 00:08:10,120
So tired come up and for the second value which is actually an integer value I need to refer to the

127
00:08:10,120 --> 00:08:18,820
name of my variable into value plus two double quotes because the second value is going to be must be

128
00:08:18,820 --> 00:08:19,970
actually of type string.

129
00:08:19,990 --> 00:08:27,340
Here we need to convert these Vadi disvalue integer into value twice think value so that we can actually

130
00:08:27,340 --> 00:08:33,940
put it here and now because we want to actually get an integer value from the database we need to comment

131
00:08:34,000 --> 00:08:38,400
out these two lines of code here because we don't want to get a string value.

132
00:08:38,410 --> 00:08:40,520
You want to get an integer value right.

133
00:08:40,750 --> 00:08:45,270
So now here at the bottom it's actually clear the law can't.

134
00:08:45,510 --> 00:08:47,280
Let's actually run our project now.

135
00:08:50,130 --> 00:08:56,030
And now let me show you the web browser and the emulator and here as you can see I just click on the

136
00:08:56,030 --> 00:08:57,980
spot and get data from server.

137
00:08:58,150 --> 00:09:00,830
And as you can see here this is the first value for this key right.

138
00:09:01,000 --> 00:09:04,560
And the value of the second key is going to be locked to the console.

139
00:09:04,630 --> 00:09:10,820
So let's go back to what I understood you in the in the Luczak here you can see this value number 100.

140
00:09:11,770 --> 00:09:18,150
So now instead of outputting this value to the log it's actually just put it to the user interface.

141
00:09:18,430 --> 00:09:27,400
So here I can see the value that set text and here I can just refer to the name of this value and the

142
00:09:27,400 --> 00:09:33,040
value of this variable into value is going to be replaced by the previous value which is actually the

143
00:09:33,040 --> 00:09:35,550
disvalue right the value of this thing value.

144
00:09:35,560 --> 00:09:40,800
But because we are calling this method that takes on this takes the value again here.

145
00:09:40,990 --> 00:09:44,670
So here I can say that it's value.

146
00:09:45,220 --> 00:09:50,470
But because this is actually as an integer value and we need to actually provide a string value for

147
00:09:50,470 --> 00:09:56,740
this method it takes that actually converted to our actually think value by concatenating this value

148
00:09:56,950 --> 00:09:58,390
to an empty string value.

149
00:09:58,600 --> 00:10:03,590
So let's actually again run our project and now let me actually opened a web browser.

150
00:10:03,850 --> 00:10:06,100
And here this is our emulator.

151
00:10:06,100 --> 00:10:09,550
So now let's actually click on the spot and get data from server.

152
00:10:09,740 --> 00:10:13,960
And now we have this value 100 right as you can see.

153
00:10:13,960 --> 00:10:17,900
So now let's actually get the value of this key.

154
00:10:17,920 --> 00:10:20,380
As you can see this is actually a category right.

155
00:10:20,490 --> 00:10:24,770
Let's get the value of this up key child here.

156
00:10:24,940 --> 00:10:26,610
So let's go back to our Android studio.

157
00:10:26,660 --> 00:10:29,680
Again we need to actually create a listener.

158
00:10:29,770 --> 00:10:31,350
So let's see how we can do that.

