When you develop Android apps, you may run into various roadblocks based on the code. Perhaps you want an app to communicate with a third‐party API that returns JSON or to perform collision detection in a game. You can usually search the web for sample code because someone else has likely already written it. Then all you have to do is review the code, alter it to fit your needs, and continue with development.
Reviewing sample code increases your knowledge even if you don’t need the code in an application. In fact, a good way to find out how to program for Android is to look at sample code. Sure, it comes supplied with the Android SDK — in the API Demos, for example (see Chapter 2) — but a truly cool plethora of real‐world application code is freely available on the web. You can find on the Internet plenty of high‐quality open source applications to serve as examples, thanks to the open source nature of Android.
Most of the ten excellent open source applications and samples in this chapter are real‐world Android applications that you can install from the Google Play Store. Try an application on your device, and then crack open its source code to see how the gears turn.
The samples folder of the Android SDK holds the source code for the various Android samples, which demonstrate how to use various Android APIs via small, digestible, working examples. You can find tons of simple, straight‐to‐the‐point examples in the ...