Weather App by Example Teaches JSON, HTTP, and API Use
Developers who are just getting started can leap through the learning curve by reading code written by more experienced programmers. It becomes even more useful if you can read an explanation of what each code chunk does, like with this weather app tutorial. Francesco Angola, who also wrote that guide on using Httpclient, has done a great job of explaining how to use a website API, parse a JSON string, and present the results to the user.
Francesco starts by exploring the data available from the Open Weather Map API. Don’t be confused by that web page title. The goal here is to gather text data on the current weather conditions, not to display on an onscreen map. Entering the URL in a browser returns a JSON string, whose format he uses to craft a parser method with the help of the JSONObject and JSONArray classes. I consider this to be the core of the guide. The parser lays out a roadmap for how the data object will be stored. This technique is easily adapted anytime you’re working with the JSON format. From here, he uses HttpClient to grab the string that feeds the parser. The guide concludes by creating a bare bones activity that displays weather conditions on screen.
Head over to his blog for the full tutorial.
Want something on the XDA Portal? Send us a tip!
As the year progresses, we draw further away from Google's annual I/O conference, and closer to the time when the latest hardware from Mountain View is made available to the public. While I/O itself remains one of the most popular tech conferences, the hardware unveiling is a contrastively low-key post across social media, but nonetheless, remains an exciting and much awaited event. In the months leading up to the unveiling, a host of leaks take place, revealing various info about...
The latest version of Touchwiz, launched alongside the Galaxy S6 and S6 Edge, was aimed at providing a vastly improved software experience in lieu of the bad reputation its predecessors had gained. While this iteration turned out to be a vast improvement in terms of lack of bloatware, fluidity and user experience, Samsung's OEM skin fell short in the aesthetics department by a long shot, abandoning a plethora of Material Design principles and leaving users wanting more. However, Theme Store...
There comes a sad time in everyone's life where you must part ways with your gadgets. Perhaps they are dropped from a height, carelessly hardbricked, or simply stashed in a drawer in favor of a shinier upgrade. Alternatively they might enter the world of the second-hand market, and become someone else's daily driver. Swappa is especially popular for this purpose here at XDA, where thousands of users trust the site enough to buy and sell their devices through it. In fact, we made...