1
00:00:00,210 --> 00:00:06,340
Hired Livan in this theater they are all going to go ahead and create another Android application.

2
00:00:06,480 --> 00:00:07,340
So just click on this.

3
00:00:07,350 --> 00:00:14,690
Start a new Android studio project here and then for the name of our application just type in here app

4
00:00:15,480 --> 00:00:24,840
55 and then click on next and here choose API 16 Android 4.1 Jelly Bean and then click on next and here

5
00:00:24,870 --> 00:00:28,690
choose empty activity next and then click on finish.

6
00:00:28,780 --> 00:00:32,770
So now as you can see here our product is actually created.

7
00:00:33,010 --> 00:00:38,860
So let's actually go inside our rest folder and then double click on the layout directory here.

8
00:00:38,880 --> 00:00:44,880
So now click and this activity underline main example and here at the bottom or just click on the Design

9
00:00:44,880 --> 00:00:46,130
tab here.

10
00:00:46,130 --> 00:00:51,210
So now as he has said here we want to actually design the user interface of our application.

11
00:00:51,330 --> 00:00:56,870
So just a select is hello world view here and then press on delete key on your keyboard.

12
00:00:56,880 --> 00:01:02,310
So now in this tutorial I want to talk more about the example files in Android.

13
00:01:02,610 --> 00:01:08,870
So just click on this layout folder here at this directory right click on it and then you and then click

14
00:01:08,890 --> 00:01:10,720
on layout resource file.

15
00:01:10,860 --> 00:01:19,350
So now I want to actually create an include file in my project so just type in here include include

16
00:01:20,280 --> 00:01:32,030
excuse me include underline and then here you can you can actually type a text underlined a button underline

17
00:01:32,340 --> 00:01:33,330
checkbox

18
00:01:35,620 --> 00:01:37,230
underline panel.

19
00:01:37,800 --> 00:01:38,440
OK.

20
00:01:38,710 --> 00:01:44,170
And then the root element should be a linear layout and the sort of said Main and the directory name

21
00:01:44,180 --> 00:01:45,870
lay out and here click on.

22
00:01:45,880 --> 00:01:46,670
OK.

23
00:01:47,080 --> 00:01:54,160
So as you can see here it's actually a glitch and these include file here and actually design the user

24
00:01:54,160 --> 00:01:57,080
interface of this file of this XML file.

25
00:01:57,250 --> 00:02:02,120
So let's actually go inside this takes a tab here just click on the text tab.

26
00:02:02,650 --> 00:02:09,520
And as you can see here this is actually these are the the example lines of code that are actually related

27
00:02:09,520 --> 00:02:10,880
to art exemplified.

28
00:02:10,990 --> 00:02:11,610
OK.

29
00:02:11,920 --> 00:02:13,500
So the orientation is vertical.

30
00:02:13,510 --> 00:02:16,840
So as you can see here the root element is linearly out there.

31
00:02:16,960 --> 00:02:18,620
The orientation is vertical.

32
00:02:18,640 --> 00:02:25,910
The layout is much parent and the layout height is much Pallant So the layout we should be wrapped content.

33
00:02:26,420 --> 00:02:31,930
Okay wrap content and the layout height also should be wrapped content.

34
00:02:32,140 --> 00:02:35,010
So now inside is linearly out here.

35
00:02:35,170 --> 00:02:39,780
I want to actually put Arctic's or takes you inside these linearly out.

36
00:02:39,820 --> 00:02:43,470
So let me actually double click on this tab here in order to make this area Vider.

37
00:02:43,630 --> 00:02:47,900
So now I am actually inside this linear layout and I want to create a text view.

38
00:02:48,280 --> 00:02:53,470
So I just need to type in text view and for the layout Viets I can't assign a value.

39
00:02:53,470 --> 00:02:55,840
For example 200.

40
00:02:56,730 --> 00:02:57,540
OK.

41
00:02:58,030 --> 00:03:02,640
And for the lay out height I can assign the value 200 dpi.

42
00:03:03,080 --> 00:03:03,650
OK.

43
00:03:04,670 --> 00:03:09,000
So now let's actually assign our text to the state's view.

44
00:03:09,170 --> 00:03:11,540
So here I can't just type in text.

45
00:03:11,660 --> 00:03:14,500
So now I just need to select this android call and text here.

46
00:03:14,510 --> 00:03:15,930
This takes attributes.

47
00:03:16,130 --> 00:03:19,680
So for the text just typing here this is text.

48
00:03:19,880 --> 00:03:20,490
OK.

49
00:03:20,750 --> 00:03:24,480
And then I can actually assign an ID to the state's view.

50
00:03:24,740 --> 00:03:28,820
So Id is going to be at sign Plus Id slash.

51
00:03:28,850 --> 00:03:31,610
So now I can actually assign an ID to the States view.

52
00:03:31,610 --> 00:03:38,900
So here I can just say Pontiac's the include and here as you can see this is our takes.

53
00:03:38,900 --> 00:03:39,720
View OK.

54
00:03:39,980 --> 00:03:43,160
So now I don't to actually create a button here.

55
00:03:43,400 --> 00:03:45,340
So again I just need to type in.

56
00:03:45,350 --> 00:03:52,070
I just need to actually open a tag here and then typing Potin and for the layout read assigned a value

57
00:03:52,070 --> 00:03:58,200
of 100 DP and for the layout height assigned a value of 100 DP.

58
00:03:58,490 --> 00:03:59,110
OK.

59
00:03:59,420 --> 00:04:06,680
And here let's actually assign a text value to this button so I can just type in text and now I can

60
00:04:06,680 --> 00:04:08,960
actually assign a text to the spot to this spot.

61
00:04:08,970 --> 00:04:14,160
And so here I can just say indices mean this is button.

62
00:04:14,570 --> 00:04:18,860
And here I can actually assign an ID to this button so I just need to type in ID.

63
00:04:19,040 --> 00:04:24,170
And here I just need to select this and do it call an idea here and then press enter key on your keyboard

64
00:04:24,890 --> 00:04:29,200
and then here just type in front plus ID slash.

65
00:04:29,410 --> 00:04:29,700
OK.

66
00:04:29,710 --> 00:04:35,390
So I just need to select the first recommendation as you can see here at St. plus read slash and then

67
00:04:35,390 --> 00:04:38,460
I can actually assign an ID to this button.

68
00:04:38,590 --> 00:04:42,730
So the idea is going to be between include.

69
00:04:42,830 --> 00:04:48,980
Now I want to actually create a checkbox inside my linear layout so the checkbox is going to be.

70
00:04:49,010 --> 00:04:55,970
So I just need to open a tag here and I just need to type in checkbox and the layout which is going

71
00:04:55,970 --> 00:05:02,440
to be for example 300 dpi and the layout height is going to be three hundred deep.

72
00:05:02,980 --> 00:05:03,630
OK.

73
00:05:03,830 --> 00:05:10,690
Or I can actually assign the value or wrap content for the layout or wrap and love content for the layout

74
00:05:10,760 --> 00:05:20,270
height and I can actually assign a text to this checkbox so the text is going to be this is checkbox

75
00:05:21,640 --> 00:05:26,350
and then I can actually assign an ID to the same box so the checkbox is.

76
00:05:26,360 --> 00:05:29,290
So the idea is going to be at same place Id slash.

77
00:05:29,600 --> 00:05:33,210
And here I can't just type in C-h X includes.

78
00:05:34,080 --> 00:05:34,630
OK.

79
00:05:34,880 --> 00:05:43,210
So as you can see here I have a text view and a button and the checkbox inside my linearly out here.

80
00:05:43,610 --> 00:05:48,150
OK so now as I can see this is this is actually my include Right.

81
00:05:48,260 --> 00:05:54,040
So let's see how we can actually use this file in our activity underline minute example here.

82
00:05:54,230 --> 00:06:00,350
So there are two ways that you can actually use your include while in your activity underline main that

83
00:06:00,350 --> 00:06:01,130
example.

84
00:06:01,370 --> 00:06:05,010
So first of all the first one is actually inside this Design tab.

85
00:06:05,030 --> 00:06:11,430
So as you can see here at the left hand side here as you can see we have these user interface components.

86
00:06:11,540 --> 00:06:18,690
So just scroll down here and inside is custom folder as you can see we have some components here.

87
00:06:18,830 --> 00:06:22,630
So just a selectees include file here as you can see include.

88
00:06:22,910 --> 00:06:26,300
And here we can actually search for your include file.

89
00:06:26,390 --> 00:06:34,280
So here I can just type in include an underline text underlined button underlined checkbox.

90
00:06:34,340 --> 00:06:36,200
So this is my include file.

91
00:06:36,350 --> 00:06:39,190
I just need to select it and then click on OK.

92
00:06:39,680 --> 00:06:46,700
So as you can see here now I have actually selected my last fight so I can put it at the center of my

93
00:06:46,700 --> 00:06:47,860
relatively old here.

94
00:06:47,990 --> 00:06:50,280
So now as you can see this is my include file.

95
00:06:50,480 --> 00:06:51,920
I have a text view.

96
00:06:51,920 --> 00:06:53,030
This is text.

97
00:06:53,090 --> 00:06:56,830
I have a button this is button and I have a checkbox.

98
00:06:56,830 --> 00:06:57,910
This is checkbox.

99
00:06:57,920 --> 00:06:58,450
OK.

100
00:06:58,580 --> 00:07:03,100
So these are the user interface components that I actually put inside my include file.

101
00:07:03,470 --> 00:07:09,990
And then inside my activity underline main that examen I can actually add these include file or keep

102
00:07:10,140 --> 00:07:13,390
in sight my activity underline me in that example.

103
00:07:13,430 --> 00:07:14,070
OK.

104
00:07:14,270 --> 00:07:18,710
So just select these include file here and then press handle on your keyboard.

105
00:07:18,710 --> 00:07:23,010
So let's actually click on this text tab here at the bottom.

106
00:07:23,030 --> 00:07:27,620
So now I want to actually add these include file here inside my relatively out.

107
00:07:27,740 --> 00:07:36,380
So here I can just open attach here and then just typing a include as you can see here include and then

108
00:07:36,380 --> 00:07:42,800
select include here and then press on space key on your keyboard and then just type in here layout.

109
00:07:43,310 --> 00:07:48,050
So here they lay out as you can see now I can actually select the layout so that the layout is going

110
00:07:48,050 --> 00:07:51,990
to be might include five includes the length takes on the length.

111
00:07:51,990 --> 00:07:53,530
What an underlined checkbox.

112
00:07:53,540 --> 00:08:00,700
So just select this one and then press enter key on your keyboard and then enter this tag here.

113
00:08:00,710 --> 00:08:05,930
So now if we are actually at the right hand side as against here we have this preview here.

114
00:08:06,070 --> 00:08:11,830
So if I click on this preview here now we can actually see this include file here or I can actually

115
00:08:12,220 --> 00:08:15,640
change to switch to design type here as you can see.

116
00:08:15,760 --> 00:08:19,130
Now as you can see this is our include file here.

117
00:08:19,390 --> 00:08:20,200
OK.

118
00:08:20,440 --> 00:08:25,690
So now let's see how we can actually use this include file in our Java codes.

119
00:08:25,770 --> 00:08:26,460
OK.

120
00:08:26,560 --> 00:08:32,540
So now in our project structure as you can see inside this job folder and inside this package I want

121
00:08:32,540 --> 00:08:37,780
to actually doubleclick on this main activity here main activity that double file.

122
00:08:37,910 --> 00:08:45,570
And now now I want to actually use my user interface components that are inside my include file.

123
00:08:45,610 --> 00:08:51,720
OK so as you can see here inside this file inside these include underlined text underlined button underlined

124
00:08:51,720 --> 00:08:53,880
checkbox underlined panel that example.

125
00:08:54,100 --> 00:09:00,850
I actually put these user interface components takes view a button and a checkbox and then I assign

126
00:09:00,910 --> 00:09:04,720
an ID to every each of these user interface components.

127
00:09:04,720 --> 00:09:09,600
So here inside this main activity that of a file here now I can actually use this.

128
00:09:09,700 --> 00:09:13,480
I can actually refer to those are user interface components.

129
00:09:13,510 --> 00:09:14,910
And then I can use them.

130
00:09:14,920 --> 00:09:17,640
So inside is uncreate Mefford.

131
00:09:17,740 --> 00:09:22,000
I want to actually declare some objects and I want to actually initialize those objects.

132
00:09:22,000 --> 00:09:25,940
So first of all I have actually a text view in say This includes file.

133
00:09:25,940 --> 00:09:26,560
Right.

134
00:09:26,560 --> 00:09:27,620
I have this text view.

135
00:09:27,730 --> 00:09:32,320
So now I want to actually declare and create an object of type text view.

136
00:09:32,350 --> 00:09:40,120
So you and the name of my object is going to be the include assignment operator and then here I need

137
00:09:40,120 --> 00:09:48,870
to actually cast this object to a text view object find view by ID or thought Id dot the include.

138
00:09:49,030 --> 00:09:54,040
And then I need to put a semicolon at the end of my statement and here as you can see again inside this

139
00:09:54,040 --> 00:09:56,550
includes file I have this button right.

140
00:09:56,710 --> 00:10:04,840
So inside this main activity that of a file I can actually create a button Sabaton PTEN include assignment

141
00:10:04,870 --> 00:10:12,940
operator and then here I need to cast this object to a button object find view by ID are thought Id

142
00:10:12,940 --> 00:10:14,710
thoughts PTEN include.

143
00:10:14,810 --> 00:10:15,120
OK.

144
00:10:15,130 --> 00:10:20,040
And then I need to actually put a semicolon at the end of my statement.

145
00:10:20,050 --> 00:10:23,920
So inside this includes file as you can see we have also a checkbox here.

146
00:10:24,070 --> 00:10:26,310
So let's actually create a checkbox here.

147
00:10:26,330 --> 00:10:33,670
Now I can just type in checkbox and the name of my object is going to be c h x x x.

148
00:10:33,700 --> 00:10:41,830
Include assignment operator and then here I need to cast this object to a checkbox object find view

149
00:10:41,830 --> 00:10:49,420
y id are that I did not see it checks include and then I need to put a semicolon at the end of my statement.

150
00:10:49,420 --> 00:10:52,050
So here I can actually make disputant this.

151
00:10:52,110 --> 00:10:52,960
See this.

152
00:10:52,960 --> 00:10:56,300
Or better yet include a listener particularly of the user.

153
00:10:56,320 --> 00:11:03,750
So I can just type in between and include that sets unclick listener as you can see here new view.

154
00:11:03,820 --> 00:11:09,250
So here I want to actually create an inner class an anonymous inner class so new viewed that unclick

155
00:11:09,250 --> 00:11:10,180
listener.

156
00:11:10,240 --> 00:11:15,360
So here is inside this in a class as you can see it is in it because it's actually implementing this

157
00:11:15,580 --> 00:11:21,260
view that unclick less than an interface and it is going to actually overwrite this man of faith here.

158
00:11:21,310 --> 00:11:21,780
OK.

