Mike Szczys · May 28, 2013 at 07:00 am

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.

[Via Reddit]


_________
Want something on the XDA Portal? Send us a tip!

Mike Szczys

szczys is an editor on XDA-Developers, the largest community for Android users. Mike Szczys is a professional musician but spends all his free time working with hobby electronics. As Contributing Editor for Hackaday.com he became interested in Android as some of the early hardware hacks started popping up on the Internet. What followed was a gradually rising addiction to all things Android. View szczys's posts and articles here.
GermainZ · Apr 21, 2015 at 09:13 am · 3 comments

CutCalc: A Calculator for Mechanical Engineers

Mechanical and mechatronics engineers may want a handy app to calculate data for drilling, milling and turning. If you're part of those, you might have searched the Play store only to give up after not finding anything useful. Fortunately, XDA Recognized Developer laufersteppenwolf found himself in that same situation, but decided to fix it by making an app to calculate what he needed. CutCalc is a simple calculator that makes tasks mechanical engineers need on a daily basis much easier,...

XDA NEWS
Jimmy McGee · Apr 21, 2015 at 07:00 am · 1 comment

Google Play Music Customizations – XDA Xposed Tuesday

If Cyanogen Inc. has its way, you won’t be forced into the Google services if you use Android. Until then, a lot of us are fully invested into the Google ecosystem. We listen to our music on Google Play Music. However, the Google Play Music app could benefit from some tweaks. In this episode of XDA Xposed Tuesday, XDA TV Producer TK reviews an Xposed Module that adds some customization options into Google Play Music. XDA Senior Member Maxr1998 offers...

XDA NEWS
Emil Kako · Apr 20, 2015 at 05:39 pm · 4 comments

Do You Use Recents as a Task Switcher?

Google introduced a revamped Recents interface with Lollipop in the hopes of making it easier for users to jump between tasks. But is Recents the best method of switching tasks? Let us know if you actually use the Recents button as a task switcher and why.

DISCUSS
Share This