Author: Budi Kurniawan
Pub Date: 2015
Format: PDF/EPUB +code
Size: 17 Mb
Android is the most popular mobile platform today, and this book is a thorough introduction to Android application development. A structured tutorial, it shows how to create applications and use the Android APIs through numerous examples. The book covers the latest Android version—KitKat—and the chapters cover topics including UI components, the latest Animation API in Android, how to record media, and how to handle asynchronous tasks.
Graphics and Custom Views
The Android SDK comes with a wide range of views that you can use in your applications. If none of these suits your need, you can create a custom view and draw on it. This chapter showed you how to create a custom view and draw multiple shapes on a canvas.
To give your users the best experience, you may want to use different layouts for different screen sizes. In this chapter , you learned that a good strategy to achieve that is to use a multi-pane layout for tablets and a single-pane layout for handsets.
In this chapter you learned about the new Animation API in Android, the Property Animation system. In particular , you learned about the android.animation.Animator
class and its subclasses, V alueAnimator and ObjectAnimator. Y ou also learned to use the AnimatorSet class to perform multiple animations.
Working with Files
You use the File API to work with files in Android applications. In addition to mastering this API, in order to work with files effectively in Android, you need to know how
Android structures its storage system and the file-related methods defined in the Context and Environment classes.
Android offers two options for applications that need to take still pictures: use a built-in intent to start Camera or use the Camera API. The first option is the easier one to use but lacks the features that the Camera API provides. This chapter showed how to use both methods.
Two methods are available if you want to equip your application with video-making capability . The first, the easy one, is by creating the default intent and passing it to
startActivityForResult. The second method is to use MediaRecorder directly . This method is harder but brings with it the full features of the device camera. This chapter showed how to use both methods to make video.
A broadcast receiver is an application component that listens to intent broadcasts. To create a receiver you must create a class that extends android.content.BroadcastReceiver and implements its onReceive method. T o register a receiver , you can either add a receiver element in the application manifest or do so programmatically by calling Context.registerReceiver(). In either case, you must define an IntentFilter that specifies what intent should cause the receiver to be triggered.
The Alarm Service
The alarm service is one of the built-in services available to Android developers. With it you can schedule an action to take place at a later time. The operation can be programmed to be carried out once or repeatedly
A content provider is an Android component used for encapsulating data that is to be shared with other applications. This chapter shows how you can create a content provider and consume its data from an external application using a ContentResolver.