1
00:00:00,300 --> 00:00:00,770
OK.

2
00:00:00,960 --> 00:00:03,430
So button ok.

3
00:00:03,520 --> 00:00:07,640
PTEN second activity.

4
00:00:08,420 --> 00:00:08,940
OK.

5
00:00:08,940 --> 00:00:14,580
Assignment operator and then here I can actually cast this object to a button object.

6
00:00:14,580 --> 00:00:22,020
So button find view by ID or that ID that PTEN second activity.

7
00:00:22,020 --> 00:00:22,850
OK.

8
00:00:23,760 --> 00:00:26,840
So now let me explain some concepts here.

9
00:00:26,880 --> 00:00:34,440
As you can see here this is our main activity and this activity actually extends this act of compact

10
00:00:34,440 --> 00:00:34,890
activity.

11
00:00:34,890 --> 00:00:35,380
OK.

12
00:00:35,580 --> 00:00:41,950
So this main activity actually inherits all of the features and behaviors that are in sight of this

13
00:00:42,140 --> 00:00:43,660
composite activity.

14
00:00:43,680 --> 00:00:49,290
So if we just hold the common key and then press on this class here and if you are using a Windows machine

15
00:00:49,290 --> 00:00:52,690
you need to hold the control key and then press on.

16
00:00:52,710 --> 00:00:55,650
These are compact activity here.

17
00:00:55,650 --> 00:00:56,480
OK.

18
00:00:56,580 --> 00:01:02,190
So as you can see here this is our app computer activity and this computer activity as you can see there

19
00:01:02,190 --> 00:01:06,140
are lots of misfits here inside of this class and here.

20
00:01:06,540 --> 00:01:13,170
This class actually inherits all of the features and behaviors that are inside of this fragment activity.

21
00:01:13,170 --> 00:01:19,800
So this class extends this fragmented activity and there is an ease our relationship between these two

22
00:01:19,800 --> 00:01:24,310
classes and computer activity is up fragment activity.

23
00:01:24,330 --> 00:01:24,930
OK.

24
00:01:25,110 --> 00:01:30,720
And if I hold the command key and then press on this a fragment activity as you can see this is our

25
00:01:30,720 --> 00:01:36,620
fragment activity and this class extends the base fragment activity honeycombs.

26
00:01:36,660 --> 00:01:44,010
So there is an is a relationship between these two classes or cases of fragment activity and this base

27
00:01:44,010 --> 00:01:45,860
fragment activity honeycomb.

28
00:01:45,980 --> 00:01:46,570
OK.

29
00:01:46,890 --> 00:01:52,740
So if it actually holds the command key and then present this class here the base fragment activity

30
00:01:52,740 --> 00:01:59,750
honeycomb as you can see it says this based fragment activity actually extends base fragment activity

31
00:01:59,850 --> 00:02:00,500
do not.

32
00:02:00,680 --> 00:02:01,230
OK.

33
00:02:01,560 --> 00:02:08,370
So this class actually is actually up base like a base fragment activity or not.

34
00:02:08,430 --> 00:02:11,380
So there is an is a relationship between these two classes.

35
00:02:11,640 --> 00:02:17,550
So if I hold the command key and then press on this class as you can see here it says this base fragment

36
00:02:17,580 --> 00:02:21,180
activity not actually extends activity.

37
00:02:21,180 --> 00:02:24,600
So there is an is a relationship between these two classes.

38
00:02:24,720 --> 00:02:25,020
OK.

39
00:02:25,070 --> 00:02:30,200
And this class inherits all of the features and behaviors that are inside of this activity class.

40
00:02:30,210 --> 00:02:36,330
So if I hold the command key and then press on this activity class as you can see it says this activity

41
00:02:36,330 --> 00:02:40,370
class actually extends this context from lapper.

42
00:02:40,420 --> 00:02:49,250
OK so now as you can see here inside of this main activity if I just say that main activity extends

43
00:02:49,260 --> 00:02:55,380
and combat activity you can see that this class is going to actually inherit lots of methods from all

44
00:02:55,380 --> 00:03:01,710
of these classes are complete activity fragment activity based flagmen activity honeycomb based fragment

45
00:03:01,710 --> 00:03:04,080
activity not and this activity class.

46
00:03:04,120 --> 00:03:10,270
Ok so are these really important because in order to create an activity in our project.

47
00:03:10,280 --> 00:03:10,840
OK.

48
00:03:11,100 --> 00:03:18,510
In order to create an activity in our project in order to show the user some of outputs on the screen

49
00:03:18,960 --> 00:03:21,180
we need to actually create an activity.

50
00:03:21,180 --> 00:03:26,160
And here we need to actually extend from this app compact activity.

51
00:03:26,170 --> 00:03:26,540
OK.

52
00:03:26,550 --> 00:03:31,960
And as you can see this is our uncreate Smurfette and we are actually inheriting the Smurfette from

53
00:03:31,960 --> 00:03:33,270
base and compare activity.

54
00:03:33,270 --> 00:03:33,690
OK.

55
00:03:33,780 --> 00:03:34,600
Uncreate.

56
00:03:34,740 --> 00:03:37,200
And as you can see here it says at sign over.

57
00:03:37,200 --> 00:03:37,610
Right.

58
00:03:37,620 --> 00:03:39,260
So we are overwriting this memory.

59
00:03:39,270 --> 00:03:39,880
OK.

60
00:03:40,200 --> 00:03:42,710
And inside of this Mefford here it says super.

61
00:03:42,780 --> 00:03:45,240
So super refers to the superclass.

62
00:03:45,240 --> 00:03:45,960
OK superb.

63
00:03:45,960 --> 00:03:47,020
That uncreate.

64
00:03:47,070 --> 00:03:52,770
So here it's going actually are called the uncreate Meffert of the superclass here as you can see.

65
00:03:52,830 --> 00:03:55,850
Initialize the uncreate effect of the superclass.

66
00:03:55,980 --> 00:03:56,580
OK.

67
00:03:56,810 --> 00:04:02,950
Superdad and create Mefford and inside of the Prentice's as you can see it says saved instance state.

68
00:04:03,120 --> 00:04:04,830
OK this is our bundle OK.

69
00:04:04,940 --> 00:04:08,170
This is actually this object is actually of type A bundle.

70
00:04:08,340 --> 00:04:09,080
OK.

71
00:04:09,510 --> 00:04:13,330
And you don't need to know about this Bondel class.

72
00:04:13,400 --> 00:04:19,450
OK but for now you just know that this is our bundle and this is an object of this one.

73
00:04:19,470 --> 00:04:20,350
And here we are.

74
00:04:20,430 --> 00:04:22,260
This is actually a parameter.

75
00:04:22,260 --> 00:04:26,160
And here we are passing these parameters through the uncreate method of the superclass.

76
00:04:26,160 --> 00:04:32,070
So if I hold the command key and go inside of this app compact activity here as you can see there is

77
00:04:32,100 --> 00:04:34,630
actually an uncreate Mfat here again.

78
00:04:34,680 --> 00:04:37,880
So this class actually is overwriting this method.

79
00:04:38,070 --> 00:04:44,640
So and here as you can see it says uncreate And yet as you can see it has an ad site nullable Bondel

80
00:04:44,700 --> 00:04:46,230
save instant state.

81
00:04:46,260 --> 00:04:51,010
So at this moment as she exits an argument of type bundle and it is actually the nullable.

82
00:04:51,220 --> 00:04:51,950
OK.

83
00:04:52,350 --> 00:04:55,140
And here you can see these implementation's inside of this method.

84
00:04:55,170 --> 00:04:55,930
OK.

85
00:04:56,340 --> 00:05:02,080
But these are not are important and you don't need to know about these implementations but inside of

86
00:05:02,110 --> 00:05:08,380
this main activity that job I find here we need to actually call the uncreate Meffert of the superclass.

87
00:05:08,380 --> 00:05:13,540
We need to actually initialize the uncreate of the super of the superclass before we can actually call

88
00:05:13,600 --> 00:05:15,080
the set content view here.

89
00:05:15,100 --> 00:05:21,120
OK so it's content view are that lay out that activity underline main.

90
00:05:21,150 --> 00:05:21,560
OK.

91
00:05:21,730 --> 00:05:26,490
So some of it is going to actually call this set content view here as you can see here.

92
00:05:26,560 --> 00:05:30,580
And this is a method that you actually inherit from the activity class.

93
00:05:30,740 --> 00:05:31,200
OK.

94
00:05:31,330 --> 00:05:34,820
And this is going to actually show the user activity main.

95
00:05:34,960 --> 00:05:38,550
So this is our activity in that example.

96
00:05:38,920 --> 00:05:40,300
Okay.

97
00:05:40,360 --> 00:05:44,820
And then here as you can see it actually created an object from this toolbar class.

98
00:05:44,860 --> 00:05:45,770
Ok toolbar.

99
00:05:45,780 --> 00:05:52,540
And here it is actually initializing this object find view by ID or that Id dot toolbar set support

100
00:05:52,570 --> 00:05:53,830
action bar tool bar.

101
00:05:53,830 --> 00:05:58,020
So it's going to actually create a toolbar in our application.

102
00:05:58,330 --> 00:06:03,120
OK so now let's let me actually comment out these two lines of code here.

103
00:06:03,160 --> 00:06:06,910
So here let's actually run our project and see what happens.

104
00:06:06,910 --> 00:06:11,110
So as you can see here our application is running on this emulator here.

105
00:06:11,260 --> 00:06:13,420
And as you can see there is no toolbar here.

106
00:06:13,570 --> 00:06:14,170
OK.

107
00:06:14,410 --> 00:06:20,320
And if I go back and say this main activity double file here again and if I uncomment these two lines

108
00:06:20,320 --> 00:06:21,180
of code here.

109
00:06:21,340 --> 00:06:22,140
OK.

110
00:06:22,510 --> 00:06:24,580
As you can see here now as soon as an error.

111
00:06:24,580 --> 00:06:25,280
OK.

112
00:06:25,480 --> 00:06:30,720
Because of we didn't actually import the toolbar class into this class here.

113
00:06:30,820 --> 00:06:35,050
So here I just need to delete this toolbar here and then type it again here.

114
00:06:35,050 --> 00:06:36,290
OK toolbar.

115
00:06:36,970 --> 00:06:42,120
OK so now the toolbar class is actually automatically imported into this class here.

116
00:06:42,190 --> 00:06:42,540
OK.

117
00:06:42,550 --> 00:06:45,430
So let's actually run our project again and see what happens.

118
00:06:45,430 --> 00:06:51,070
So as you can see here our application is running again here on the simulator and you can see this toolbar

119
00:06:51,100 --> 00:06:53,090
here OK at 50.

120
00:06:53,290 --> 00:06:55,590
So hopefully that makes sense.

121
00:06:55,580 --> 00:07:00,760
And now let's actually go back and say this main activity that our fight here again and here I want

122
00:07:00,760 --> 00:07:06,640
to actually make the Spartan this PTEN second activity button a listener to the clicks that the user

123
00:07:06,640 --> 00:07:09,700
make on the button inside of this screen here.

124
00:07:09,700 --> 00:07:10,220
OK.

125
00:07:10,480 --> 00:07:12,900
So as you can see here I made a mistake here.

126
00:07:13,030 --> 00:07:15,910
And let's to go back and say this content underline that example.

127
00:07:15,910 --> 00:07:22,030
And here I need to click on this a clear cashier and here as you can see for the text of this button

128
00:07:22,510 --> 00:07:27,470
I just need to delete this letter T here and then press enter key on your keyboard.

129
00:07:27,490 --> 00:07:28,200
OK.

130
00:07:28,690 --> 00:07:32,970
So let's go back inside this our main activity that will fight here let's actually close this.

131
00:07:33,010 --> 00:07:35,470
I've compiled activity out of a file.

132
00:07:35,470 --> 00:07:39,410
Now I want to make the spot in listeners to the clicks that they use and make on the spot.

133
00:07:39,430 --> 00:07:40,050
OK.

134
00:07:40,150 --> 00:07:47,120
So here I just need to type in between such an activity that sits on click listener.

135
00:07:47,400 --> 00:07:47,910
OK.

136
00:07:49,190 --> 00:07:53,050
So unclick listener is actually an interface in Java.

137
00:07:53,210 --> 00:07:59,300
OK so here inside Apprentice's I need to actually specify the activity that this listener is belong

138
00:07:59,300 --> 00:07:59,580
to.

139
00:07:59,600 --> 00:08:00,290
OK.

140
00:08:00,470 --> 00:08:05,200
So first of all let me actually hear implement did unclick listener interface.

141
00:08:05,210 --> 00:08:09,350
So here I just need to implement implement view.

142
00:08:09,950 --> 00:08:13,940
That's unclick listener.

143
00:08:14,510 --> 00:08:16,750
So as you can see here this is actually an interface.

144
00:08:16,760 --> 00:08:20,320
Ok if you look at unclick and it is an interface in Java.

145
00:08:20,630 --> 00:08:26,420
And as you can see it is showing us an error and it says class main activity must either be declared

146
00:08:26,450 --> 00:08:31,440
abstract or implement implement abstract Smurfette unclick.

147
00:08:31,610 --> 00:08:33,690
As you can see here in unclick listener.

148
00:08:34,090 --> 00:08:34,570
OK.

149
00:08:34,910 --> 00:08:36,770
So this is actually an interface.

150
00:08:36,770 --> 00:08:43,580
And as you know are about interfaces in Java that are abstract methods in interfaces and in an interface.

151
00:08:43,580 --> 00:08:51,500
And we need to actually add every class that implements that interface need to actually implement the

152
00:08:51,500 --> 00:08:54,080
inherited method from that interface.

153
00:08:54,100 --> 00:09:00,650
Ok so here if we need to actually implement that inherited method that is inside of this unclick listener

154
00:09:00,860 --> 00:09:01,750
interface.

155
00:09:01,760 --> 00:09:07,780
So after this uncreate method let's actually type in here and click OK.

156
00:09:07,790 --> 00:09:12,730
So as you can see here this is the inherited Meffert from this article it's an interface.

157
00:09:12,770 --> 00:09:15,350
And if I press Enter key on my keyboard.

158
00:09:15,740 --> 00:09:17,340
Now you can see the Smurfette here.

159
00:09:17,360 --> 00:09:17,770
OK.

160
00:09:17,840 --> 00:09:21,560
Sign over right public Voyt and click it.

161
00:09:21,590 --> 00:09:22,210
OK.

162
00:09:22,520 --> 00:09:28,240
And this is if it actually exits an argument of type view and the name of this argument is the OK we

163
00:09:28,250 --> 00:09:32,940
can actually change the name of this argument to another value for example view.

164
00:09:33,200 --> 00:09:33,840
OK.

165
00:09:34,190 --> 00:09:40,310
And every court that we actually put in here is going to happen after we actually click on this.

166
00:09:40,310 --> 00:09:42,480
Let's go to say second activity button here.

167
00:09:42,590 --> 00:09:43,200
OK.

168
00:09:44,080 --> 00:09:51,070
So now inside Apprentice's I need to specify the activity the class that this listener actually belongs

169
00:09:51,070 --> 00:09:51,250
to.

170
00:09:51,250 --> 00:09:51,650
OK.

171
00:09:51,730 --> 00:09:57,410
So here we are making this between second activity a listener to the clicks that the user makes.

172
00:09:57,470 --> 00:09:58,670
OK on this button.

173
00:09:58,690 --> 00:09:59,210
OK.

174
00:09:59,410 --> 00:10:02,780
So here I need to specify the activity so I can just type in this.

175
00:10:03,070 --> 00:10:05,100
So this refers to this class.

176
00:10:05,230 --> 00:10:05,690
OK.

