Android Recipes: A Problem-Solution Approach, 3rd Edition

Android Recipes: A Problem-Solution Approach, 3rd Edition

English | 2014 | ISBN: 978-1-4302-6322-7 | 760 Pages | PDF, EPUB | 15 MB


Android continues to be one of the leading mobile OS and development platforms driving today’s mobile innovations and the apps ecosystem. Android appears complex, but offers a variety of organized development kits to those coming into Android with differing programming language skill sets.
Android Recipes: A Problem-Solution Approach, Third Edition offers more than 100 down-to-earth code recipes, and guides you step-by-step through a wide range of useful topics using complete and real-world working code examples. It’s updated to include the KitKat Android 4.4 SDK as well as earlier releases.
Instead of abstract descriptions of complex concepts, in Android Recipes, you’ll find live code examples. When you start a new project you can consider copying and pasting the code and configuration files from this book and then modifying them for your own customization needs.
Crammed with insightful instruction and helpful examples, this third edition of Android Recipes is your guide to writing apps for one of today’s hottest mobile platforms. It offers pragmatic advice that will help you get the job done quickly and well. This can save you a great deal of work over creating a project from scratch!

+

Getting Started with Android

Android has excited many people who are developing (and even selling) apps for this platform. It’s not too late to join in the fun, and this chapter got you started.

You first learned that Android is a software stack for mobile devices and that this stack consists of apps, middleware, and the Linux operating system. You also learned about Android’s history, including the various SDK updates that have been made available.

You then focused on installing the Android SDK and an Android platform, creating an AVD, and starting the emulator with this AVD.

Finally, you learned how to create and use external libraries in an Android application. Specifically, you were exposed to the Android Support Library and Google Play Services, both of which you will use throughout this book in a number of recipes.

In Chapter 2, you will learn how to begin crafting your application’s user interface by looking at how Android handles views, graphics, and drawing.

Views, Graphics, and Drawing

In this chapter, you saw many of the tools that the Android framework provides to display content to the user. We explored techniques for creating, customizing, and animating views, as well as ways to draw discrete content directly to the screen using elements such as Canvas and Surface. You were exposed to the many customizations available in the application window, including custom transition animations from one screen to another. Finally, we looked at how you can leverage the resource qualifier system to create optimized view layouts for different screen configurations. In the next chapter, we will examine some more of the elements in the UI toolkit that are focused on interacting with the user and implementing common patterns for app navigation.

User Interaction Recipes

In this chapter, we explored a number of techniques that we can use to build a compelling user interface that conforms to the design guidelines that Google has set forth for the Android platform. We started out looking at how to effectively use the action bar interface elements in applications. We explored managing configuration changes such as device orientation in creative ways. You saw techniques for managing user input through text and touch handling. Finally, you were exposed to implementing common navigation patterns such as the drawer layout and swipe-paging views.

In the next chapter, we will look at using the SDK to communicate with the outside world by accessing network resources and talking to other devices by using technologies such as USB and Bluetooth.

Communications and Networking

Connecting an Android application to the Web and web services is a great way to add user value in today’s connected world. Android’s framework for connecting to the Web and other remote hosts makes adding this functionality straightforward. We’ve explored how to bring the standards of the Web into your application, using HTML and JavaScript to interact with the user, but within a native context. You also saw how to use Android to download content from remote servers and consume it in your application. We also showed that a web server is not the only host worth connecting to, by using Bluetooth, NFC, and SMS to communicate directly from one device to another. In the next chapter, we will look at using the tools that Android provides to interact with a device’s hardware resources.