1 00:00:04,700 --> 00:00:07,129 Alright, so this bit about the Reader 2 00:00:07,129 --> 00:00:09,559 can be important. Now if you remember, we 3 00:00:09,559 --> 00:00:11,510 were discussing huge files a few videos 4 00:00:11,510 --> 00:00:13,940 ago. In this app, we're reading the entire 5 00:00:13,940 --> 00:00:17,540 XML into one string. But the XMLPull 6 00:00:17,540 --> 00:00:19,640 Parser's quite happy to be given a Reader, 7 00:00:19,640 --> 00:00:21,980 and to process the data as it comes down 8 00:00:21,980 --> 00:00:24,349 from the internet. Now the PullParser 9 00:00:24,349 --> 00:00:25,759 doesn't hang on to text that it's 10 00:00:25,759 --> 00:00:28,160 already processed - it just throws it away. 11 00:00:28,160 --> 00:00:30,590 So if you did want to process gigabytes 12 00:00:30,590 --> 00:00:33,380 of RSS on an Android device, you could 13 00:00:33,380 --> 00:00:35,059 connect the Reader to the input stream, 14 00:00:35,059 --> 00:00:37,850 instead of providing the entire string. 15 00:00:37,850 --> 00:00:39,920 Now of course, if your users are paying 16 00:00:39,920 --> 00:00:42,410 to download data, then they may not be too 17 00:00:42,410 --> 00:00:43,850 impress downloading that data on a 18 00:00:43,850 --> 00:00:46,310 mobile data plan. So there are other 19 00:00:46,310 --> 00:00:48,050 things to consider, in addition to the 20 00:00:48,050 --> 00:00:50,540 memory on the device, but the options are 21 00:00:50,540 --> 00:00:53,210 available if you need them. Okay, so 22 00:00:53,210 --> 00:00:55,280 as the PullParser processes its 23 00:00:55,280 --> 00:00:58,489 input, various events will happen. Now 24 00:00:58,489 --> 00:01:00,530 this will be things like entering a tag 25 00:01:00,530 --> 00:01:02,870 or reaching the end of the document. Now 26 00:01:02,870 --> 00:01:05,059 we can get those events and respond to 27 00:01:05,059 --> 00:01:07,460 them in our code. So the first thing we 28 00:01:07,460 --> 00:01:09,740 do is check the event, and make sure that 29 00:01:09,740 --> 00:01:10,789 we haven't reached the end of the 30 00:01:10,789 --> 00:01:12,679 document - the end of the XML, that is - 31 00:01:12,679 --> 00:01:16,369 that's this code here on line 28. Now if 32 00:01:16,369 --> 00:01:17,960 we haven't then, of course, we shouldn't 33 00:01:17,960 --> 00:01:19,969 have unless the XML was empty. Then the 34 00:01:19,969 --> 00:01:22,549 while loop will keep looping until we do 35 00:01:22,549 --> 00:01:25,700 get to the end. Now inside the loop is 36 00:01:25,700 --> 00:01:27,289 where we get the values of the fields 37 00:01:27,289 --> 00:01:29,840 we're interested in. As long as we check 38 00:01:29,840 --> 00:01:32,659 the event type each time around, we can 39 00:01:32,659 --> 00:01:34,639 just keep checking for the tags we want, 40 00:01:34,639 --> 00:01:38,329 until there's no more XML left. So let's 41 00:01:38,329 --> 00:01:41,270 go ahead and write some more code now. So 42 00:01:41,270 --> 00:01:43,490 we've got the code there for checking, to 43 00:01:43,490 --> 00:01:44,420 see whether we've reached the end of the 44 00:01:44,420 --> 00:01:46,670 document. So within the while loop, we're now 45 00:01:46,670 --> 00:01:50,709 going to type in the code; val tagName 46 00:01:50,709 --> 00:01:55,759 is equal to xpp.name dot to 47 00:01:55,759 --> 00:01:58,700 Lowercase. And I'm just going to put a 48 00:01:58,700 --> 00:02:03,799 comment here, as a TODO: we should use 49 00:02:03,799 --> 00:02:09,770 the safe call operator, and more on that 50 00:02:09,770 --> 00:02:12,860 later. So on the next line, we're going to do 51 00:02:12,860 --> 00:02:14,500 when 52 00:02:14,500 --> 00:02:18,200 parentheses eventType and open the code 53 00:02:18,200 --> 00:02:20,570 block. I'm going to start with the first 54 00:02:20,570 --> 00:02:24,800 one which will be XmlPullParser dot 55 00:02:24,800 --> 00:02:27,650 START_TAG. So we need to add 56 00:02:27,650 --> 00:02:31,670 our arrow there, and a code block. Then we'll 57 00:02:31,670 --> 00:02:34,580 do a Log.d for starters, TAG comma 58 00:02:34,580 --> 00:02:37,330 and then double quotes, parse colon 59 00:02:37,330 --> 00:02:43,210 Starting tag for, and then + tagName. 60 00:02:43,210 --> 00:02:47,240 Then if, parentheses, tagName is equal 61 00:02:47,240 --> 00:02:51,500 equal to entry, in lowercase - again, we're 62 00:02:51,500 --> 00:02:52,820 opening a code block. That's going to be 63 00:02:52,820 --> 00:02:57,020 inEntry equals true. Then outside of the 64 00:02:57,020 --> 00:02:59,090 code block, we're just finishing off 65 00:02:59,090 --> 00:03:01,190 those two tags. So we've got the 66 00:03:01,190 --> 00:03:02,750 ending tag for the if and then the 67 00:03:02,750 --> 00:03:05,390 ending tag for the XmlPullParser dot 68 00:03:05,390 --> 00:03:09,410 START_TAG. So after that, the next one to 69 00:03:09,410 --> 00:03:13,790 check will be XmlPullParser.TEXT. Then 70 00:03:13,790 --> 00:03:18,200 I'm going to use an arrow again, and it's 71 00:03:18,200 --> 00:03:22,970 going to be textValue equals xpp dot 72 00:03:22,970 --> 00:03:28,850 text. Next, we're going to do XmlPull 73 00:03:28,850 --> 00:03:35,350 Parser.END_TAG, then arrow again. 74 00:03:35,350 --> 00:03:37,880 And then we need a code block for 75 00:03:37,880 --> 00:03:40,510 that, and let's add a log first, so Log 76 00:03:40,510 --> 00:03:44,390 dot d again, and the log's going to be 77 00:03:44,390 --> 00:03:47,840 TAG in parentheses, and the second 78 00:03:47,840 --> 00:03:51,140 argument after the comma is parse: Ending tag 79 00:03:51,140 --> 00:03:57,620 for + tagName. Then next line, if 80 00:03:57,620 --> 00:04:04,489 parenthesis in Entry parenthesis, then 81 00:04:04,489 --> 00:04:09,920 when parentheses tagName, then open a 82 00:04:09,920 --> 00:04:11,480 code block. I'm gonna start with entry 83 00:04:11,480 --> 00:04:15,890 in double quotes, then arrow and open a 84 00:04:15,890 --> 00:04:18,440 code block. Then we're gonna do applications 85 00:04:18,440 --> 00:04:24,020 dot addCurrentRecord and set inEntry 86 00:04:24,020 --> 00:04:25,990 to false, so inEntry equals false. 87 00:04:25,990 --> 00:04:28,190 Then currentRecord, we're gonna 88 00:04:28,190 --> 00:04:33,260 set to a new object - FeedEntry. So we 89 00:04:33,260 --> 00:04:36,170 create a new object, just to be clear 90 00:04:36,170 --> 00:04:40,280 what we're doing that for. Now I need a 91 00:04:40,280 --> 00:04:42,050 parentheses after FeedEntry there, 92 00:04:42,050 --> 00:04:45,340 because we are creating a new object. 93 00:04:45,340 --> 00:04:48,710 Okay, then we're closing off that when, 94 00:04:48,710 --> 00:04:50,510 or the first condition, which is 95 00:04:50,510 --> 00:04:53,360 entry. The next one we're going to test 96 00:04:53,360 --> 00:04:56,260 is name, so name in double quotes, arrow. 97 00:04:56,260 --> 00:04:59,630 We're going to set currentRecord.name to 98 00:04:59,630 --> 00:05:04,010 equal textValue. Next, artist in double 99 00:05:04,010 --> 00:05:07,990 quotes, lower case, arrow currentRecord dot 100 00:05:07,990 --> 00:05:13,040 artist equals textValue. Next, in double 101 00:05:13,040 --> 00:05:18,860 quotes, is releaseDate arrow current 102 00:05:18,860 --> 00:05:22,220 Record.releaseDate is equal to text 103 00:05:22,220 --> 00:05:26,450 Value. Two more; summary and double quotes 104 00:05:26,450 --> 00:05:30,650 arrow currentRecord.summary is 105 00:05:30,650 --> 00:05:33,770 equal to textValue, and the last one 106 00:05:33,770 --> 00:05:37,610 will be image, and that's going to be current 107 00:05:37,610 --> 00:05:42,590 record.imageURL is equal to text 108 00:05:42,590 --> 00:05:47,150 Value. Okay. And the other thing we need to do 109 00:05:47,150 --> 00:05:50,600 outside of this loop here, down here - we're 110 00:05:50,600 --> 00:05:54,110 going to put Nothing else to do, so we're 111 00:05:54,110 --> 00:05:57,650 going to put eventType equals xpp dot 112 00:05:57,650 --> 00:05:59,960 next. So I'm going to move on to the next 113 00:05:59,960 --> 00:06:03,780 one. 114 00:06:03,780 --> 00:06:06,330 Okay. Now inside the while loop that 115 00:06:06,330 --> 00:06:07,950 we've just created, we start off by 116 00:06:07,950 --> 00:06:11,220 getting the name of the current tag, and 117 00:06:11,220 --> 00:06:12,750 that's this one here - the code on line 118 00:06:12,750 --> 00:06:15,810 29. We do that each time around the loop, 119 00:06:15,810 --> 00:06:17,910 and it's worth noting that name can be 120 00:06:17,910 --> 00:06:21,660 null, if the parser isn't inside a tag. Now 121 00:06:21,660 --> 00:06:23,310 we should use the safe call operator 122 00:06:23,310 --> 00:06:24,960 there, but I want to show you something 123 00:06:24,960 --> 00:06:26,370 confusing about the logcat, 124 00:06:26,370 --> 00:06:28,590 so I'll left it out. There's a TODO 125 00:06:28,590 --> 00:06:30,330 command so I don't forget to add it in 126 00:06:30,330 --> 00:06:32,790 later. Now, we can then take different 127 00:06:32,790 --> 00:06:35,550 action, depending on the type of event 128 00:06:35,550 --> 00:06:38,040 that's happened inside the parser. At 129 00:06:38,040 --> 00:06:39,690 some point, it's going to read the start 130 00:06:39,690 --> 00:06:42,600 of a tag in the XML, so when that happens, 131 00:06:42,600 --> 00:06:45,930 the event type will actually change to 132 00:06:45,930 --> 00:06:48,600 START_TAG, as you can see here. So if that 133 00:06:48,600 --> 00:06:51,780 happens, we're only interested IF it's an 134 00:06:51,780 --> 00:06:53,760 entry tag, because we're only doing 135 00:06:53,760 --> 00:06:55,979 anything with the data in the individual 136 00:06:55,979 --> 00:06:58,229 entries. Now you could if you wanted, 137 00:06:58,229 --> 00:07:00,630 modify this slightly, so it displays the 138 00:07:00,630 --> 00:07:02,669 title of the feed, but we're not going to 139 00:07:02,669 --> 00:07:04,680 do that. At least, I'm not going to do it, 140 00:07:04,680 --> 00:07:06,210 but it would make a good challenge so 141 00:07:06,210 --> 00:07:07,139 you never know. 142 00:07:07,139 --> 00:07:09,390 Alright. So if we have got an entry tag, 143 00:07:09,390 --> 00:07:12,300 we set inEntry to true. You can see that 144 00:07:12,300 --> 00:07:15,180 here - the code on line 35. Now as long as 145 00:07:15,180 --> 00:07:17,970 inEntry is true, we know we can use the 146 00:07:17,970 --> 00:07:19,680 data for the tags we're interested in. 147 00:07:19,680 --> 00:07:21,660 Now at the end of the loop, we 148 00:07:21,660 --> 00:07:23,850 check the next event by calling the 149 00:07:23,850 --> 00:07:25,950 PullParser's next method - this one down 150 00:07:25,950 --> 00:07:28,919 here, on line 62. Now that basically tells 151 00:07:28,919 --> 00:07:31,350 the parser to continue working through 152 00:07:31,350 --> 00:07:34,200 the XML until the next interesting thing 153 00:07:34,200 --> 00:07:36,630 happens. Now that could be it finds an 154 00:07:36,630 --> 00:07:39,620 end tag or it finds a value in the tag, 155 00:07:39,620 --> 00:07:42,120 it reaches the end of the document or so 156 00:07:42,120 --> 00:07:43,890 on. We don't know what the next event 157 00:07:43,890 --> 00:07:45,990 will be, but as long as it's not the end 158 00:07:45,990 --> 00:07:47,880 of the document, we'll go around our loop 159 00:07:47,880 --> 00:07:50,610 again. So every time there's a START_TAG 160 00:07:50,610 --> 00:07:53,280 event, and the tag is entry, then we get 161 00:07:53,280 --> 00:07:54,870 ready to store the data for a new 162 00:07:54,870 --> 00:07:57,840 application. Now if the event type is 163 00:07:57,840 --> 00:08:01,590 TEXT, as you can see here on line 39, then 164 00:08:01,590 --> 00:08:03,330 that's the PullParser telling us the 165 00:08:03,330 --> 00:08:05,850 date's available. So in that case, we're 166 00:08:05,850 --> 00:08:08,010 storing the data in the String variable 167 00:08:08,010 --> 00:08:10,650 textValue. Now you may think that we 168 00:08:10,650 --> 00:08:12,390 could store the value in the application 169 00:08:12,390 --> 00:08:14,220 object at this point, but that's actually 170 00:08:14,220 --> 00:08:17,670 not how XML works. Let me switch back to 171 00:08:17,670 --> 00:08:20,730 the XML in Chrome, and just scroll the 172 00:08:20,730 --> 00:08:23,940 raw XML up to the top. We'll go back to 173 00:08:23,940 --> 00:08:27,210 our XML, and what's actually at the top there. 174 00:08:27,210 --> 00:08:29,760 Now you can see the event starting tag 175 00:08:29,760 --> 00:08:33,169 here, right at the top. 176 00:08:33,169 --> 00:08:35,610 So at this point, the tag name would be 177 00:08:35,610 --> 00:08:37,740 entry. Now as the PullParser 178 00:08:37,740 --> 00:08:39,840 carries on parsing, it'll get to the 179 00:08:39,840 --> 00:08:42,390 updated tag - the next line - and then 180 00:08:42,390 --> 00:08:44,159 there'll be another START_TAG 181 00:08:44,159 --> 00:08:46,290 event. so the tag name would now be 182 00:08:46,290 --> 00:08:48,840 updated. So next there'll be a text event, 183 00:08:48,840 --> 00:08:51,060 and we have that date available if you 184 00:08:51,060 --> 00:08:53,280 want it - that's the date that's between 185 00:08:53,280 --> 00:08:56,220 the updated starting tag and the updated 186 00:08:56,220 --> 00:08:59,100 ending tag. So then it'll hit the end tag 187 00:08:59,100 --> 00:09:02,040 for updated, the start tag for ID, and 188 00:09:02,040 --> 00:09:04,140 then we get the URL in the next TEXT 189 00:09:04,140 --> 00:09:06,990 event. So as it works its way through the 190 00:09:06,990 --> 00:09:09,990 entry, the text it keeps finding changes 191 00:09:09,990 --> 00:09:12,930 all the time. Now the only way that 192 00:09:12,930 --> 00:09:14,340 we can be sure that the text that's 193 00:09:14,340 --> 00:09:16,530 available is for any particular tag, is 194 00:09:16,530 --> 00:09:18,990 to wait until there's an END_TAG event, 195 00:09:18,990 --> 00:09:22,410 and store the data at that point. So 196 00:09:22,410 --> 00:09:24,210 looking at the first name entry in our 197 00:09:24,210 --> 00:09:26,610 event tag here, which is this one down 198 00:09:26,610 --> 00:09:29,340 here. When the end tag is reached we know 199 00:09:29,340 --> 00:09:30,990 that we can use the text value and 200 00:09:30,990 --> 00:09:34,260 that'll be the value for the name tag. So 201 00:09:34,260 --> 00:09:38,160 going back to the code. That's what the 202 00:09:38,160 --> 00:09:39,900 code does - it stores the text whenever 203 00:09:39,900 --> 00:09:42,240 new text is available, and that's here on 204 00:09:42,240 --> 00:09:45,270 line 39, but doesn't actually do anything 205 00:09:45,270 --> 00:09:47,250 with it until an END_TAG event happens - 206 00:09:47,250 --> 00:09:49,230 and that's the code here that we're 207 00:09:49,230 --> 00:09:52,440 testing on line 41. When we do get an END_TAG 208 00:09:52,440 --> 00:09:54,660 event, we're checking to make sure the 209 00:09:54,660 --> 00:09:56,640 PullParser is still inside an entry tag, 210 00:09:56,640 --> 00:09:59,070 so we're checking if inEntry is set to 211 00:09:59,070 --> 00:10:01,830 true. And of course, that's inEntry that we 212 00:10:01,830 --> 00:10:04,500 set earlier. If it is, we can test the tag 213 00:10:04,500 --> 00:10:07,530 name and assign the variable to 214 00:10:07,530 --> 00:10:09,030 the correct field of the currentRecord 215 00:10:09,030 --> 00:10:10,890 object. And that's what this code is 216 00:10:10,890 --> 00:10:12,470 doing here - we're checking to see whether 217 00:10:12,470 --> 00:10:15,720 name, artist, release date, summary or image 218 00:10:15,720 --> 00:10:17,730 has been found in the XML, and we're 219 00:10:17,730 --> 00:10:19,470 setting the appropriate value from our 220 00:10:19,470 --> 00:10:23,370 feed entry object. And that's current 221 00:10:23,370 --> 00:10:25,320 Record which we're creating each time 222 00:10:25,320 --> 00:10:28,920 we're finding a new ending tag 223 00:10:28,920 --> 00:10:30,279 for entry, and that's 224 00:10:30,279 --> 00:10:32,499 this currentRecord. Now it's very 225 00:10:32,499 --> 00:10:35,259 important to get the case right for 226 00:10:35,259 --> 00:10:37,600 these tag names. remember that we convert 227 00:10:37,600 --> 00:10:41,319 the names to lowercase, and we're doing 228 00:10:41,319 --> 00:10:44,170 that here on line 29 - xpp.name dot 229 00:10:44,170 --> 00:10:46,809 toLowerCase. So we have to use the 230 00:10:46,809 --> 00:10:48,819 lowercase tag names in our when block 231 00:10:48,819 --> 00:10:53,100 down here, lines 51 through 55 and also - 232 00:10:53,100 --> 00:10:55,449 well basically, any part of this when 233 00:10:55,449 --> 00:10:57,490 block that reference's a tag name 234 00:10:57,490 --> 00:11:00,670 has to be in lowercase. So releaseDate 235 00:11:00,670 --> 00:11:03,370 may cause problems, and you can see I've 236 00:11:03,370 --> 00:11:05,050 made a typo here because I put release 237 00:11:05,050 --> 00:11:07,360 Date with a capital D, but we have to be 238 00:11:07,360 --> 00:11:10,420 consistent here and use lowercase, again, 239 00:11:10,420 --> 00:11:12,670 because we've specified and converted 240 00:11:12,670 --> 00:11:14,829 our tags to lowercase. So I've changed 241 00:11:14,829 --> 00:11:16,319 that correctly back to what it was, 242 00:11:16,319 --> 00:11:18,550 releasedate, or what it should be rather, 243 00:11:18,550 --> 00:11:21,569 which is releasedate all lowercase. 244 00:11:21,569 --> 00:11:24,279 Alright, so back to our conditions, when 245 00:11:24,279 --> 00:11:26,559 we get an END_TAG event. The first one 246 00:11:26,559 --> 00:11:28,569 checks if the tag name is entry - that's 247 00:11:28,569 --> 00:11:31,420 this code here on line 45. In which case, 248 00:11:31,420 --> 00:11:33,550 we've reached the end of all our data 249 00:11:33,550 --> 00:11:36,009 for our currentRecord. So that means 250 00:11:36,009 --> 00:11:38,199 that we can add currentRecord to the 251 00:11:38,199 --> 00:11:41,019 list of applications, then set inEntry 252 00:11:41,019 --> 00:11:43,660 to false, because this is the end tag for 253 00:11:43,660 --> 00:11:45,939 entry. And we finish by creating a new 254 00:11:45,939 --> 00:11:47,800 FeedEntry object, ready for the next 255 00:11:47,800 --> 00:11:49,899 entry details, if indeed there is another 256 00:11:49,899 --> 00:11:52,420 entry. Otherwise, we're checking the tag 257 00:11:52,420 --> 00:11:57,009 name - the code, lines 51 through 55 - to 258 00:11:57,009 --> 00:11:58,420 see if it matches any of the fields 259 00:11:58,420 --> 00:12:00,639 we're interested in. If it does we set 260 00:12:00,639 --> 00:12:02,139 the corresponding field of current 261 00:12:02,139 --> 00:12:04,059 Record to the value that's stored in 262 00:12:04,059 --> 00:12:06,490 textValue. And that's the main loop - the 263 00:12:06,490 --> 00:12:08,050 only other thing I've done is added a 264 00:12:08,050 --> 00:12:09,910 couple of logging lines, so that we can 265 00:12:09,910 --> 00:12:11,230 see what's happening when the program 266 00:12:11,230 --> 00:12:15,639 runs. Alright, so that's the main loop. Alright, 267 00:12:15,639 --> 00:12:17,110 there's one more thing I want to do here, 268 00:12:17,110 --> 00:12:19,389 temporarily, and that's to loop through 269 00:12:19,389 --> 00:12:22,209 the application list, once all the 270 00:12:22,209 --> 00:12:24,970 XML's been processed, and just print 271 00:12:24,970 --> 00:12:27,490 out the values of the fields so that we 272 00:12:27,490 --> 00:12:29,709 can be sure that it's worked okay. So 273 00:12:29,709 --> 00:12:31,779 let's go ahead and add that code, and 274 00:12:31,779 --> 00:12:33,309 that's going to be down here before the 275 00:12:33,309 --> 00:12:36,670 return. So I'm going to do that, well 276 00:12:36,670 --> 00:12:38,079 actually, I'm going to do it here after the 277 00:12:38,079 --> 00:12:41,350 eventType xpp.next, after that 278 00:12:41,350 --> 00:12:43,569 closing code block. Down here, we're going 279 00:12:43,569 --> 00:12:44,110 to write the 280 00:12:44,110 --> 00:12:49,110 code; for parenthesis app, app in 281 00:12:49,110 --> 00:12:52,329 applications, parenthesis code block. 282 00:12:52,329 --> 00:12:57,399 We're going to do Log.d parentheses, and I'm 283 00:12:57,399 --> 00:12:59,440 just going to add some stars here - 284 00:12:59,440 --> 00:13:05,850 some asterisks - then a Log.d TAG comma 285 00:13:05,850 --> 00:13:11,350 app.toString. And I'll fix this up 286 00:13:11,350 --> 00:13:15,839 as well - 287 00:13:15,839 --> 00:13:25,540 TAG comma, like so. So note that I've put 288 00:13:25,540 --> 00:13:28,209 that code outside of the while loop, so 289 00:13:28,209 --> 00:13:30,910 as long as there's no exceptions thrown, we 290 00:13:30,910 --> 00:13:32,680 should see the details for all the 291 00:13:32,680 --> 00:13:35,170 applications in the logcat. And because 292 00:13:35,170 --> 00:13:37,570 we overrode the toString method for 293 00:13:37,570 --> 00:13:39,610 the FeedEntry class, we'll get more 294 00:13:39,610 --> 00:13:41,200 useful information than we would 295 00:13:41,200 --> 00:13:43,240 have got with the default function, 296 00:13:43,240 --> 00:13:44,829 including the values of some of the 297 00:13:44,829 --> 00:13:47,740 fields. Okay, so we're almost ready to run 298 00:13:47,740 --> 00:13:49,480 the app and see if the XML is parsed 299 00:13:49,480 --> 00:13:51,730 correctly. All we would have to do is 300 00:13:51,730 --> 00:13:53,170 call this parse method. 301 00:13:53,170 --> 00:13:55,779 So back in MainActivity, I'm going to 302 00:13:55,779 --> 00:13:59,140 open that up, and the place to do 303 00:13:59,140 --> 00:14:01,209 the parsing is in the onPost 304 00:14:01,209 --> 00:14:04,300 Execute method, and that of course, is for 305 00:14:04,300 --> 00:14:07,750 our DownloadData class - onPost 306 00:14:07,750 --> 00:14:10,720 Execute. Now we don't need to log the XML 307 00:14:10,720 --> 00:14:12,279 anymore because that bit's working 308 00:14:12,279 --> 00:14:14,769 fine. Now we're also logging the XML 309 00:14:14,769 --> 00:14:16,990 at the start of our parse function, so 310 00:14:16,990 --> 00:14:18,940 there's no need to log it twice. So I'm 311 00:14:18,940 --> 00:14:20,410 actually going to comment the logging 312 00:14:20,410 --> 00:14:23,940 line out, in the onPostExecute function. 313 00:14:23,940 --> 00:14:25,779 Then we're going to add the code to 314 00:14:25,779 --> 00:14:31,079 create our parser. I'm going to type val 315 00:14:31,079 --> 00:14:35,800 parseApplications equals Parse 316 00:14:35,800 --> 00:14:38,350 Applications parentheses - we're creating the 317 00:14:38,350 --> 00:14:40,149 object. Then we're going to do parse 318 00:14:40,149 --> 00:14:45,310 Applications.parse parentheses result, 319 00:14:45,310 --> 00:14:49,360 sorry results. The other thing I want to 320 00:14:49,360 --> 00:14:51,250 do, is change the argument here for 321 00:14:51,250 --> 00:14:53,949 onPostResult, onPostExecute, which is 322 00:14:53,949 --> 00:14:56,050 result String question mark. Let's 323 00:14:56,050 --> 00:14:57,640 remove the question mark, 324 00:14:57,640 --> 00:15:01,120 and that fixes up that error as well. So 325 00:15:01,120 --> 00:15:02,410 in the next video, we're gonna run the 326 00:15:02,410 --> 00:15:05,410 application and see if it works. So I'll see 327 00:15:05,410 --> 00:15:08,339 you in the next video.