Android json parser



we want the fetchweathertask toreturn an array of string forecasts. this means we need to modifythe return type of the asynctask to be a string array. the effect of this is that thedoinbackground method will now return in this method,after we query the server and


Android json parser, then read in the input stream,we're going to perform this code. to parse the response from the server,we call getweatherdatafromjson. we pass in the forecast json string,as well as the number of forecast days. to make sure that this isreturning the right string array,


we can go into the method, and then atthe bottom of the method, we just add some logging statements to print outevery element of the string array.


Android json parser

now, when you compile the code andrun it on your device, you can hit the refresh button topull the data from the server. then, if you open up log cat, you cansee that it was parsed correctly, where you see all the forecastentries being printed out.


Android json parser Rating: 4.5 Diposkan Oleh: PaduWaras