1
00:00:00,150 --> 00:00:05,770
Hi everyone in this theater we're going to go ahead and create another Android application.

2
00:00:05,790 --> 00:00:06,690
So just click on this.

3
00:00:06,720 --> 00:00:13,170
Start in your Android studio project and then for the application name just type in here app furtively

4
00:00:13,890 --> 00:00:23,130
and then click on next year choose AP A16 Android 4.1 Jelly Bean next and Blancher activity next and

5
00:00:23,130 --> 00:00:24,450
then click on finish.

6
00:00:24,450 --> 00:00:30,310
Now let's actually delete this hello takes you here and then our present delete key on your keyboard.

7
00:00:30,390 --> 00:00:33,860
Now let's actually double click on the rest folder here.

8
00:00:33,870 --> 00:00:37,890
Lay out and then activity underline made that example.

9
00:00:38,190 --> 00:00:43,110
And then here selectees filleting action button and then press on the right here on your keyboard.

10
00:00:43,110 --> 00:00:43,640
OK.

11
00:00:43,950 --> 00:00:48,120
So now let's actually go back inside this content underline that example.

12
00:00:48,330 --> 00:00:50,780
And now let's actually click on this.

13
00:00:50,780 --> 00:00:52,060
It takes tap here.

14
00:00:52,200 --> 00:00:52,860
OK.

15
00:00:53,190 --> 00:00:54,660
And here is actually the change.

16
00:00:54,660 --> 00:00:58,130
These are relatively out here to takes to you.

17
00:00:58,320 --> 00:00:58,830
OK.

18
00:00:58,980 --> 00:01:04,150
And then here as you can see if you have text you here inside these texts.

19
00:01:04,170 --> 00:01:08,790
So in this tutorial we want to actually create a simple application.

20
00:01:08,790 --> 00:01:09,280
OK.

21
00:01:09,480 --> 00:01:15,330
So let's actually go to the Android documentation as you can see we have this audio adapter here.

22
00:01:15,420 --> 00:01:15,750
OK.

23
00:01:15,750 --> 00:01:22,290
And this area adapter or inherits all of the features and behaviors of this of this base after class

24
00:01:22,800 --> 00:01:28,340
and implements the filter table interface and this fiend spinner adapter.

25
00:01:28,380 --> 00:01:35,530
So as you can see here it says a concrete base adapter that is backed by an array of arbitrary objects.

26
00:01:35,550 --> 00:01:36,320
OK.

27
00:01:36,690 --> 00:01:43,770
By default this class expects that the provided resource ID references on a single text view.

28
00:01:43,830 --> 00:01:44,560
OK.

29
00:01:44,940 --> 00:01:47,790
However the text view is referenced.

30
00:01:48,000 --> 00:01:48,460
OK.

31
00:01:48,540 --> 00:01:52,740
It will be filled with the string of each object in the array.

32
00:01:52,900 --> 00:01:57,550
OK you can add the lists or arrays of custom objects.

33
00:01:57,570 --> 00:01:58,040
OK.

34
00:01:58,140 --> 00:02:02,700
So that's why we actually change this relatively And here are two text view.

35
00:02:02,760 --> 00:02:08,450
OK because we want to actually look at our array of objects into this text view here.

36
00:02:08,550 --> 00:02:09,320
OK.

37
00:02:09,660 --> 00:02:15,410
So as you can see here inside this design type instead instead of a relatively out we have a text view.

38
00:02:15,570 --> 00:02:16,310
OK.

39
00:02:16,790 --> 00:02:18,140
So.

40
00:02:18,350 --> 00:02:22,660
Now let's actually go back and say this main activity class here.

41
00:02:22,730 --> 00:02:23,500
OK.

42
00:02:23,600 --> 00:02:28,370
And then let's actually delete these lines of quote that are related to the Options menu.

43
00:02:28,580 --> 00:02:29,180
OK.

44
00:02:29,600 --> 00:02:33,820
And then delete this block of code that is related to the floating action button.

45
00:02:34,070 --> 00:02:36,550
And now we can actually put in our own code here.

46
00:02:36,560 --> 00:02:42,080
So now inside of this main activity class I'm going to put in Assignment some lines of code and then

47
00:02:42,080 --> 00:02:44,180
I'm going to actually explain to you what's going on here.

48
00:02:44,180 --> 00:02:48,080
So as you can see here we have an array of string values here.

49
00:02:48,080 --> 00:02:48,640
OK.

50
00:02:48,740 --> 00:02:52,670
So he had as he can see the name of our array is called names.

51
00:02:52,820 --> 00:02:56,590
And I actually assign these values to my Aure as you can see here.

52
00:02:56,660 --> 00:02:57,260
OK.

53
00:02:57,590 --> 00:03:03,750
So here I in line 12 I declared an object of type 3 adapter.

54
00:03:03,800 --> 00:03:04,280
OK.

55
00:03:04,460 --> 00:03:09,790
And as you can see here this object actually accepts a values of type string.

56
00:03:09,950 --> 00:03:10,630
OK.

57
00:03:11,120 --> 00:03:14,550
So now we want to actually create a list view.

58
00:03:14,570 --> 00:03:15,090
OK.

59
00:03:15,200 --> 00:03:21,910
So instead of extending from the African past activity this time we want to actually extend from these

60
00:03:21,960 --> 00:03:24,450
a list activity class.

61
00:03:24,710 --> 00:03:27,730
OK so what is this list activity class.

62
00:03:27,800 --> 00:03:31,030
Let's actually go back to the Android documentation.

63
00:03:31,100 --> 00:03:37,310
As you can see here we have this list activity class here and in your web browser you can't just type

64
00:03:37,310 --> 00:03:40,300
in RL and you will be guided to this page.

65
00:03:40,580 --> 00:03:46,820
So here as you can see the list actually with the class actually inherits all of the features and behaviors

66
00:03:47,150 --> 00:03:49,440
that are inside of this activity class.

67
00:03:49,490 --> 00:03:50,090
OK.

68
00:03:50,480 --> 00:04:00,500
So as you can see here now it says an activity that displays a list of items by binding to a data source

69
00:04:00,560 --> 00:04:01,830
such as an array.

70
00:04:01,880 --> 00:04:02,310
OK.

71
00:04:02,390 --> 00:04:05,650
So we have an array in our project as you can see here.

72
00:04:05,660 --> 00:04:06,660
This is the.

73
00:04:06,920 --> 00:04:07,450
OK.

74
00:04:07,670 --> 00:04:14,640
So to our data source such as an array or cursor and exposes our event handlers.

75
00:04:14,750 --> 00:04:21,110
When the user selects an item OK list activity hosts a list view object.

76
00:04:21,140 --> 00:04:24,310
OK that can be bound to different data sources.

77
00:04:24,380 --> 00:04:28,590
Typically either an array or the cursor hold the inquiry results.

78
00:04:28,600 --> 00:04:29,470
OK.

79
00:04:29,750 --> 00:04:32,950
So let's actually go back to the Android studio here.

80
00:04:33,020 --> 00:04:39,950
As you can see there's actually as you can see we cannot any more call this method as you can see here.

81
00:04:39,950 --> 00:04:45,860
So let's actually did it this method here and it's actually delete this object and we don't want to

82
00:04:45,860 --> 00:04:52,100
actually call this sets content view as you can see here are that lay out that activity made here anymore

83
00:04:52,370 --> 00:04:56,660
because this is what is actually showing the layout to the user.

84
00:04:56,660 --> 00:04:57,120
OK.

85
00:04:57,320 --> 00:05:03,310
So we don't want to call the Smurfette OK because if you have a text view inside this content underline

86
00:05:03,310 --> 00:05:04,380
main that example OK.

87
00:05:04,520 --> 00:05:09,070
So we don't want to actually call this our second interview here.

88
00:05:09,430 --> 00:05:09,920
OK.

89
00:05:09,950 --> 00:05:15,890
Now I want to actually instantiate this adapter object as you can see here that I actually declared

90
00:05:16,070 --> 00:05:17,100
in line 11.

91
00:05:17,120 --> 00:05:21,240
So I want to instantiate this object inside this uncreate method.

92
00:05:21,250 --> 00:05:22,230
As you can see here.

93
00:05:22,400 --> 00:05:23,000
OK.

94
00:05:23,150 --> 00:05:27,990
So I'm going to paste this line of code here and then I'm going to explain to you what's going on here.

95
00:05:28,010 --> 00:05:32,490
So as you can see here this is the line of code that actually pasted here after.

96
00:05:32,500 --> 00:05:35,800
So I actually referred to the name of this adapter object.

97
00:05:35,810 --> 00:05:36,080
OK.

98
00:05:36,110 --> 00:05:38,370
Assignment operator new.

99
00:05:38,510 --> 00:05:39,170
OK.

100
00:05:39,450 --> 00:05:40,590
Arey adapter.

101
00:05:40,730 --> 00:05:41,190
OK.

102
00:05:41,270 --> 00:05:44,810
As you can see inside these tanks I put in this string here.

103
00:05:44,810 --> 00:05:45,400
OK.

104
00:05:45,710 --> 00:05:51,800
And then inside the Prentice's I need to actually assign somebody else first of all I need to actually

105
00:05:51,800 --> 00:05:53,330
specify the context.

106
00:05:53,510 --> 00:05:54,000
OK.

107
00:05:54,110 --> 00:05:55,560
So the context is this class.

108
00:05:55,610 --> 00:05:57,320
Ok main activity that this.

109
00:05:57,650 --> 00:06:05,000
And then I need to actually specify the view that I want to actually put in my art objects too.

110
00:06:05,210 --> 00:06:05,700
OK.

111
00:06:05,720 --> 00:06:08,150
So as you can see here this is the view.

112
00:06:08,220 --> 00:06:15,080
OK I want to actually put these are our values to this view OK or else that content me k content underline

113
00:06:15,080 --> 00:06:15,540
meaning.

114
00:06:15,770 --> 00:06:17,380
And these are the values.

115
00:06:17,460 --> 00:06:22,360
Calls names as you can see here I actually referred to the name of this array.

116
00:06:22,430 --> 00:06:23,620
OK calls names.

117
00:06:23,660 --> 00:06:26,130
These are the values that I want to actually put in this view.

118
00:06:26,150 --> 00:06:31,970
I want to actually call a method that we actually inherit from this list activity class.

119
00:06:31,970 --> 00:06:38,270
So I can just type in here set list adapter as you can see here we have this Mfat So if we actually

120
00:06:38,270 --> 00:06:44,120
hold the command key and click on this method here for Windows users you can actually hold the control

121
00:06:44,120 --> 00:06:45,500
key and then click on dismiss it.

122
00:06:45,500 --> 00:06:46,260
OK.

123
00:06:46,580 --> 00:06:52,120
So as you can see here this is the Meffert that is inside of this list activity that Java class.

124
00:06:52,130 --> 00:06:52,680
OK.

125
00:06:52,790 --> 00:06:58,210
Set list that after and this if it actually exits an argument of type list adapter.

126
00:06:58,220 --> 00:06:59,590
OK adapter.

127
00:06:59,750 --> 00:07:02,600
So let's actually go back and say this main activity that Joe right here.

128
00:07:02,750 --> 00:07:09,170
And as you can see here we have this adapter object here as you can see here every adapter and we can

129
00:07:09,170 --> 00:07:11,590
actually put this adapter here.

130
00:07:11,720 --> 00:07:12,570
OK.

131
00:07:12,980 --> 00:07:18,040
So as you can see here now let's actually run our project and see what happens.

132
00:07:18,060 --> 00:07:18,510
OK.

133
00:07:18,620 --> 00:07:24,200
So as you can see here now our application is running on the simulator here and now we can see these

134
00:07:24,200 --> 00:07:25,420
values here.

135
00:07:25,430 --> 00:07:25,850
OK.

136
00:07:25,910 --> 00:07:29,420
Android developer of course are U.S. developers of course and undervalues.

137
00:07:29,460 --> 00:07:29,870
OK.

138
00:07:29,960 --> 00:07:33,560
So if you have a simple list view in our application.

139
00:07:33,590 --> 00:07:39,740
So now I want to actually do something up when the user clicks on one of these items inside of this

140
00:07:39,740 --> 00:07:40,580
list list.

141
00:07:40,610 --> 00:07:41,280
OK.

142
00:07:41,330 --> 00:07:45,260
So for that purpose we need to actually implement an interface.

143
00:07:45,260 --> 00:07:49,460
So here just typing implements our adapter view.

144
00:07:49,930 --> 00:07:50,540
OK.

145
00:07:50,590 --> 00:07:55,730
Dot on item click listener.

146
00:07:55,850 --> 00:07:56,260
OK.

147
00:07:56,420 --> 00:08:03,310
We need to actually implement this on item calculus and in interface as you can see here and here inside

148
00:08:03,310 --> 00:08:08,470
of these uncreate MF'er First of all let's actually create an object of type list view.

149
00:08:08,600 --> 00:08:10,260
So they've been here at least we do.

150
00:08:10,370 --> 00:08:18,260
And the name of our object is LS The View assignment operator and and here I want to actually call MFL

151
00:08:18,320 --> 00:08:21,830
that we actually inherit from this list activity class.

152
00:08:21,860 --> 00:08:26,590
So here after the assignment operator just type in here gets list view.

153
00:08:27,050 --> 00:08:33,050
So as you can see here this method is going to actually get the list view of our application and that

154
00:08:33,080 --> 00:08:36,680
is going to actually assign that view to this object elative you.

155
00:08:36,680 --> 00:08:43,050
So if we actually hold the command key and press on this method method here as you can see.

156
00:08:43,240 --> 00:08:48,330
So this method is actually inside this list activity the Java file and this is our method.

157
00:08:48,350 --> 00:08:48,910
OK.

158
00:08:49,160 --> 00:08:52,120
So let's go back inside this main activity there job of file here.

159
00:08:52,370 --> 00:08:58,830
And after this line of code in line 25 this actually refers to the name of this object.

160
00:08:58,850 --> 00:09:07,360
LS The View that sits on item as you can see here sits an item.

161
00:09:07,370 --> 00:09:13,490
Click listen here and here inside of these Apprentice's you need to actually putting a value of type

162
00:09:13,580 --> 00:09:14,760
on item click listener.

163
00:09:14,900 --> 00:09:21,200
So because this main activity class is actually implementing this and after that an item click listener

164
00:09:21,290 --> 00:09:23,390
interface as you can see here.

165
00:09:23,390 --> 00:09:30,050
So there is an ease or relationship between these two or between these main activity class and these

166
00:09:30,090 --> 00:09:31,940
are items like listener interface.

167
00:09:31,940 --> 00:09:38,650
So here I can just typing a main activity dot this.

168
00:09:39,230 --> 00:09:44,800
OK here I am specifying that this main activity that class is going to be the listener.

169
00:09:44,990 --> 00:09:45,600
OK.

170
00:09:45,890 --> 00:09:52,820
And then after the ending curly brace of these uncreate Smurfette here as you can see we need to actually

171
00:09:52,820 --> 00:09:54,740
implement as you can see here.

172
00:09:55,100 --> 00:10:03,930
It says classman activity must either be declared abstract or implement abstract method on item click

173
00:10:04,160 --> 00:10:04,540
here.

174
00:10:04,580 --> 00:10:05,180
As you can see.

175
00:10:05,190 --> 00:10:10,490
So here are after the ending calibrates of this uncreate Meffert and inside of this main activity class

176
00:10:10,840 --> 00:10:14,260
let's actually override this method.

177
00:10:14,270 --> 00:10:15,240
All right click here.

178
00:10:15,260 --> 00:10:18,650
As you can see here and then our person enter key on your keyboard.

