1
00:00:00,360 --> 00:00:05,570
Everyone in this theater early on we're going to go ahead and create and apply this.

2
00:00:05,580 --> 00:00:06,180
OK.

3
00:00:06,300 --> 00:00:11,810
And in this application we're going to actually use the expandable list view in our application.

4
00:00:12,060 --> 00:00:13,800
So let me show you how this works.

5
00:00:13,920 --> 00:00:19,970
As you can see here we have an application that actually uses an expandable list view.

6
00:00:20,130 --> 00:00:26,340
And if we actually tickle the kindest support here as you can see here now about this group view this

7
00:00:26,430 --> 00:00:28,980
sport is actually has a child.

8
00:00:29,010 --> 00:00:29,530
OK.

9
00:00:29,730 --> 00:00:35,820
And we can see that these are values that are inside of this support group view is actually are actually

10
00:00:35,820 --> 00:00:37,860
the children of this sport.

11
00:00:37,880 --> 00:00:38,540
OK.

12
00:00:38,640 --> 00:00:45,090
And if I click on this computer as you can see we have this computer and we have these children of this

13
00:00:45,090 --> 00:00:46,190
computer.

14
00:00:46,260 --> 00:00:49,550
And as you can see this is the same story for the food here.

15
00:00:49,560 --> 00:00:51,160
So this is called the group view.

16
00:00:51,210 --> 00:00:51,800
OK.

17
00:00:52,050 --> 00:00:55,990
And these are the children of this group view as you can see here.

18
00:00:56,130 --> 00:01:04,050
And if you have car OK and we have these children and this child of this car and we have these TV and

19
00:01:04,050 --> 00:01:06,500
we have these children of these TV.

20
00:01:06,600 --> 00:01:07,210
OK.

21
00:01:07,500 --> 00:01:13,290
So in this obligation between we can actually create an app like this we need to actually click on this

22
00:01:13,350 --> 00:01:21,360
start in your Android studio project and then for the application name just type in here app 55 and

23
00:01:21,360 --> 00:01:31,330
then click on next and he has two API 16 Android 4.1 Jelly Bean next launch activity next and then click

24
00:01:31,370 --> 00:01:32,300
and finish.

25
00:01:32,470 --> 00:01:38,700
And now let's actually select this hello or take you here and then press on delete key on your keyboard

26
00:01:39,150 --> 00:01:45,690
and then double click on this address folder here lay out and then activity underline made that example.

27
00:01:45,690 --> 00:01:48,930
So now it's actually the selectees of floating action button here.

28
00:01:48,960 --> 00:01:50,980
And then press on delete key on your keyboard.

29
00:01:51,000 --> 00:01:51,510
OK.

30
00:01:51,690 --> 00:01:56,520
So let's actually to go back inside this content underline made that example and here of any to actually

31
00:01:56,790 --> 00:01:59,330
design the user interface of our application.

32
00:01:59,340 --> 00:02:05,140
Now let's actually try and expandable this view into this lay out here.

33
00:02:05,140 --> 00:02:11,760
OK but first of all it's actually a linear layout vertical into this relatively out and put it at the

34
00:02:11,760 --> 00:02:19,500
center of these relatively here and now let's actually go inside these containers for that as you can

35
00:02:19,500 --> 00:02:20,420
see here.

36
00:02:20,580 --> 00:02:22,800
As you can see we have these expandable at least.

37
00:02:22,830 --> 00:02:23,310
OK.

38
00:02:23,340 --> 00:02:28,840
Just select it and put it at the center of these linearly outwards the call.

39
00:02:29,010 --> 00:02:29,890
OK.

40
00:02:29,910 --> 00:02:36,000
And as you can see we have these expendible is you hear double click on it as you can see we have this

41
00:02:36,000 --> 00:02:36,600
idea here.

42
00:02:36,600 --> 00:02:37,200
OK.

43
00:02:37,320 --> 00:02:43,340
So this is the idea of this expendible this view and just leave it as default expendible this view OK.

44
00:02:43,500 --> 00:02:47,780
So let's actually go back inside the Smain activity that you will find here and now this actually did

45
00:02:47,780 --> 00:02:47,950
it.

46
00:02:47,940 --> 00:02:51,280
These lines of code that are related to the to the Options menu.

47
00:02:51,300 --> 00:02:51,830
OK.

48
00:02:52,140 --> 00:02:56,290
And here I select this block of code and then delete this.

49
00:02:56,410 --> 00:03:00,360
OK as you can see this block of code is actually related to the fluting action button.

50
00:03:00,390 --> 00:03:00,830
OK.

51
00:03:01,020 --> 00:03:02,190
So we don't need it.

52
00:03:02,490 --> 00:03:10,140
And now inside this class there's actually create an object of type expandable list view expand double

53
00:03:10,920 --> 00:03:17,820
list view as you can see here you have this up close here expandable list view and actually give a name

54
00:03:17,820 --> 00:03:22,020
to this object expand the broadest view and put a semicolon here.

55
00:03:22,050 --> 00:03:27,680
So as you can see here we are just declaring this object here inside of this class and inside of these

56
00:03:27,750 --> 00:03:28,460
uncreate.

57
00:03:28,510 --> 00:03:30,640
I want to initialize this object.

58
00:03:30,720 --> 00:03:36,210
So here I could just refer to the name of this object expandable list view assignment operator.

59
00:03:36,360 --> 00:03:41,210
And here I need to cast this object on to an expandable view object.

60
00:03:41,430 --> 00:03:48,900
So as you can see here find view by id r that Id dot expendible list view.

61
00:03:49,050 --> 00:03:49,690
OK.

62
00:03:49,950 --> 00:03:52,500
And then put a semicolon at the end of your statement.

63
00:03:52,830 --> 00:03:55,600
So now let's actually create a Java class.

64
00:03:55,620 --> 00:03:56,230
OK.

65
00:03:56,730 --> 00:04:01,370
So that we can actually bind are expendable.

66
00:04:01,420 --> 00:04:04,960
Few coats of it these are expendable Eastview OK.

67
00:04:05,100 --> 00:04:12,250
So if you actually create another separate class our job would be more our work would be more cleaner.

68
00:04:12,330 --> 00:04:13,070
OK.

69
00:04:13,440 --> 00:04:20,670
And it is more professional to actually create a classes for every specific job that you want to actually

70
00:04:20,700 --> 00:04:23,130
perform in your program.

71
00:04:23,130 --> 00:04:24,970
So I just need to click on file.

72
00:04:25,010 --> 00:04:25,660
Neal.

73
00:04:25,940 --> 00:04:26,380
Okay.

74
00:04:26,550 --> 00:04:36,190
And then dhaba class and here for the name of my class I can just type in expandable list view adapter.

75
00:04:36,600 --> 00:04:37,350
OK.

76
00:04:37,690 --> 00:04:44,820
So as you can see here are the job of the adapter is to actually buying the data of the view that we

77
00:04:44,820 --> 00:04:45,770
have in our layouts.

78
00:04:45,780 --> 00:04:46,300
OK.

79
00:04:46,440 --> 00:04:49,430
So that's why we need to actually create an adapter.

80
00:04:49,440 --> 00:04:50,310
OK.

81
00:04:50,430 --> 00:04:52,780
And then click on OK.

82
00:04:53,490 --> 00:04:57,230
So as you can see here we have these expandable this new adapter here.

83
00:04:57,330 --> 00:04:57,840
OK.

84
00:04:57,840 --> 00:05:06,390
So now we need to actually extend from the base are expandable list adapter class.

85
00:05:06,420 --> 00:05:12,390
So as you can see here we have these basic expandable adapter and this glass expandable this adapter

86
00:05:12,720 --> 00:05:19,710
is actually inheriting all of the features and behaviors that are inside of this base expandable adapter

87
00:05:19,950 --> 00:05:20,430
class.

88
00:05:20,460 --> 00:05:20,930
OK.

89
00:05:21,120 --> 00:05:26,530
So let's actually open our web browser and see what is this based expandable adapter.

90
00:05:26,580 --> 00:05:30,860
So as you can see here this is the android documentation and you can actually enter this.

91
00:05:30,990 --> 00:05:35,540
You are ill in your web browser in order to be guided to this page.

92
00:05:35,760 --> 00:05:38,430
And we have these are based expandable adapter.

93
00:05:38,640 --> 00:05:41,190
And as you can see here this is actually an abstract class.

94
00:05:41,190 --> 00:05:41,920
OK.

95
00:05:42,120 --> 00:05:44,750
So objects can be created from this class.

96
00:05:44,790 --> 00:05:45,660
OK.

97
00:05:45,660 --> 00:05:54,120
And here you can see it says that base class for a expandable list adapter used to provide data and

98
00:05:54,120 --> 00:05:57,880
views from some data to an expandable view.

99
00:05:57,960 --> 00:05:58,650
OK.

100
00:05:58,650 --> 00:06:04,220
So if you have an expandable is you here as you can see this is our least view and this class expandable

101
00:06:04,360 --> 00:06:07,000
this adapter used to provide data.

102
00:06:07,110 --> 00:06:07,480
Okay.

103
00:06:07,500 --> 00:06:11,660
And views from some data are to an expandable list view.

104
00:06:11,700 --> 00:06:12,690
OK.

105
00:06:12,870 --> 00:06:20,910
Adapter's inheriting this class should verify that the base implementations of get combined child ID

106
00:06:21,180 --> 00:06:27,730
and get combined group ID are correct in generating unique IDs from the group or student IDs.

107
00:06:27,750 --> 00:06:28,380
OK.

108
00:06:28,800 --> 00:06:33,980
And we can see some efforts that are inside of the space expandable it after class.

109
00:06:34,160 --> 00:06:35,090
OK.

110
00:06:35,250 --> 00:06:37,520
And we need to actually implement some of those methods.

111
00:06:37,560 --> 00:06:37,790
OK.

112
00:06:37,800 --> 00:06:45,060
And you can see we have these if it's here gets combined globality and we have this good group type

113
00:06:45,150 --> 00:06:46,430
and other methods.

114
00:06:46,650 --> 00:06:53,580
So now let's actually go to our Android studio and let's to go inside this expandability adapter class

115
00:06:53,580 --> 00:06:54,030
here.

116
00:06:54,150 --> 00:06:56,260
And as you can see it's now showing us an error.

117
00:06:56,460 --> 00:07:03,120
So let's actually hover our mouse pointer here and it says class expendible this adapter must either

118
00:07:03,120 --> 00:07:10,530
be declared abstract or implement abstract methods that are inside of these base expandable adapter.

119
00:07:10,530 --> 00:07:18,030
So how can we know actually what are the methods what are the abstract benefits that we need to actually

120
00:07:18,030 --> 00:07:19,800
implement inside of this class.

121
00:07:19,800 --> 00:07:25,830
So here I can just right click inside of this class expendible this adapter and then click on generate

122
00:07:26,340 --> 00:07:30,350
as you can see here and then click on implement Misfit's.

123
00:07:30,600 --> 00:07:35,430
So as you can see here we need to actually implement all of these methods that are here.

124
00:07:35,600 --> 00:07:36,360
OK.

125
00:07:36,870 --> 00:07:40,650
As you can see if you have lots of efforts here and we need to actually implement all of these benefits

126
00:07:40,890 --> 00:07:43,720
or in other words we need to actually overwrite these methods.

127
00:07:43,820 --> 00:07:48,890
OK so here if I click on OK as you can see now the error is gone.

128
00:07:49,020 --> 00:07:54,900
OK now I am actually overwriting them if the methods that I am actually inheriting from these abstract

129
00:07:54,900 --> 00:07:55,610
class.

130
00:07:55,850 --> 00:07:56,360
OK.

131
00:07:56,550 --> 00:08:01,590
So this is really important but first of all it's actually putting some more lines of code here inside

132
00:08:01,590 --> 00:08:05,310
of this class and then we're going to go ahead and implement these methods.

133
00:08:05,340 --> 00:08:12,020
OK so now I'm pasting some lines of code here and then I'm going to explain to you what's going on here.

134
00:08:12,060 --> 00:08:12,810
OK.

135
00:08:13,110 --> 00:08:17,760
So as you can see here these are the lines of code that I actually paste that here first of all I actually

136
00:08:17,760 --> 00:08:21,600
created an array of string values as you can see here.

137
00:08:21,600 --> 00:08:23,720
This is actually a one dimensional array.

138
00:08:24,060 --> 00:08:26,500
And the name of this area is group names.

139
00:08:26,640 --> 00:08:33,000
So as you can see here in our emulator this is our application and these are the names of the group

140
00:08:33,000 --> 00:08:34,300
will take groupings.

141
00:08:34,350 --> 00:08:40,680
So as you can see here sport computer food court TV and here as you can see inside of this Arai I actually

142
00:08:40,680 --> 00:08:49,420
assign these values sports computer food court TV and we have a two dimensional array for child names

143
00:08:49,650 --> 00:08:50,670
as you can see here.

144
00:08:50,670 --> 00:08:52,780
This is actually a two dimensional array.

145
00:08:52,890 --> 00:08:56,030
And the name of these are Ariz child names.

146
00:08:56,520 --> 00:09:03,780
And as you know our two dimensional art is actually an hour raise is actually a raise or an alley of

147
00:09:03,880 --> 00:09:04,580
race.

148
00:09:04,830 --> 00:09:05,400
OK.

149
00:09:05,610 --> 00:09:09,480
Our two dimensional alley is actually an army of Ivory's.

150
00:09:09,620 --> 00:09:10,250
OK.

151
00:09:10,260 --> 00:09:17,570
So if you have an A here and we have some trees inside of these arii OK for example for the first grade

152
00:09:17,590 --> 00:09:23,320
that is actually inside of this army we have boxing kickboxing judo football basketball.

153
00:09:23,320 --> 00:09:29,190
And here we can see that if I click on this sport here you can see these values inside of this sport

154
00:09:29,250 --> 00:09:29,620
here.

155
00:09:29,670 --> 00:09:30,530
OK.

156
00:09:30,990 --> 00:09:35,880
And as you can see if you have for the second grade that is actually inside of these child names two

157
00:09:35,880 --> 00:09:36,750
dimensional array.

158
00:09:36,760 --> 00:09:40,580
We have this computer laptop computer smartphone computer.

159
00:09:40,680 --> 00:09:43,940
And if you click on this computer you can see these values.

160
00:09:44,520 --> 00:09:48,460
And here you can see that we have another ice cream banana.

161
00:09:48,840 --> 00:09:56,190
And as you can see this is for food and you have Mercedes-Benz and we have this card here and we have

162
00:09:56,190 --> 00:09:58,690
these same same TV and LG TV.

163
00:09:58,860 --> 00:10:00,470
And this is for these TV here.

164
00:10:00,610 --> 00:10:01,000
Well Kate.

