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!
A lot of vehicles come with stereos featuring Bluetooth connectivity. This allows you to play music from your mobile device in your car. Recently, XDA TV Producer TK reviewed a Bluetooth adapter that plugged into your car's AUX input and connected to your phone with Bluetooth. However, that it not the only option if your car doesn't support Bluetooth. In this episode of XDA TV, Producer rirozizo reviews the Vinsic Doosl Fm Transmitter. This device connects to your headphone jack...
It is that time of the year again, and we are approaching the day where Android fans all over the world gather to watch the livestream of Google’s I/O conference. Among the expected announcements lay wearables, Android Auto, hints at VR and the Internet of Things and, of course, a new version of Android. An early glimpse of a supposed “Android M” was caught on the official website before being nuked out of existence, and thus the speculation began. ...
The LG G4 was announced on April 29th with its Snapdragon 808 SoC, a welcomed change from its higher-end cousin, the overheating 810. Packing 3GB of RAM, 32GB of storage, a 3000mAh battery, and an impressive 16MP camera, the G4 is widely considered to be one of the best flagships of 2015. After almost a month of release speculation, the major US carriers have finally released some information regarding the device's availability, and here's what we know so far: ...