Sponsored By

[Book Review] Android 3.0 Animations Beginners Guide

Animations add spice to the Android applications and provide nice gesture to the user. Android Framework offers animation framework which enable android developers an ease to create custom animations and tweens.

Abhishek Dey, Blogger

January 29, 2012

11 Min Read

Overview

Honeycomb enable Acer Iconia

Honeycomb enable Acer Iconia

"Android is the next popular OS for current generation mobiles or more correctly the smart-phones. Smart-phones are no more a professional device. The devices have now become feature full, harbors a hard processing power, RAM, permanent storage and larger screens providing you the ease to handle day to day work. Moreover, smart phones are now slowly capturing the hearts of the gaming world. Smart phones not only provide good processing power and run-time memory, they do render a strong graphics display. Applications rich in User Interface with animations and Games utilize the underlying hardware's full horse power to render themselves. These animations add spice to the Android applications and provide nice gesture to the user. Android Framework offers animation framework which enable android developers an ease to create custom animations and tweens."

Packt Publishers Ltd.

          

Google Android

          

Android 3.0 (Honeycomb)

Android 3.0 Animations

Author

Pages

Publisher

Rating

ISBN

Book Tagline

 





About the Author

Alex Shaw has been an Android fan boy since Android 1.5 arrived, and he began developing software for it almost immediately. He has presented at DroidCon in Berlin and London, and written applications for business, academia, and pleasure. An alumnus of The University of Edinburgh, he has kept close business and social ties with the Scottish geek scene. His consulting company, Glastonbridge Software Limited, provides development resources to the Edinburgh software industry. He has written a music composing application for the platform also known as the Synthulator which uses an extensible DSP engine. Working with Dan Stowell, he helped bringing the expressive power of  the SuperCollider(more about SuperCollider servers here) server to Android, and hopes it will spearhead a new era in embedded music creation.

 About the Book

Android 3.0 Animations authored by Alex Shaw was published on November, 2011 by Packt Publishers under ISBN 978-1849515283. The book introduces you to the animation framework of the Android SDK. The book gives you a good overview of the topics such as introduction to basic animation techniques in Android 3.0, using Frame animations, Tweening and Android animators, effects of different animation properties and tweening pages, extending tween animations and creating specialized classes for tweens, 3D visual techniques such as showing depth and rotations using transformations, creating surfaces for 2D animations, creating live wallpapers and a nice theoretical chapter on good practices & style.

The book is available in ePub, Hardback and ebook format from Packt's site. The Packt book page contains sample chapters and table of contents. Premium members are given access to the complete source code of this book. Any kind of errata info can also be found here. For more information on purchase, please visit Packt's site.

Lets Animate!

To learn animation you must first really know how animation is done. Animation tools provide you lots of option to build your animation. The first chapter serves a great start and introduces general animation techniques that are mostly used in developing animated applications. The first few topics will introduce you to the frame animation with the help of an Android example and tweening techniques. With Honeycomb or Android 3.0, a view can be animated by changing some parameters with respect to frames. These are governed by certain entry points or the Animators. Android provides a specialized "Surface" to draw and control your frames on them to provide high performance animation. Author presents a simple example to illustrate the need of the "Surface". Chapter ends with introduction to the 3D animation.  The source code of the examples can be downloaded from the Packt's website.

The second chapter extends the traditional frame animation. The book presents a famous stick-man example to illustrate the technique. The whole animation can be done just by creating a XML using Android's animation list. There are specialized XML elements which makes your animation scene drawable. The same are explained properly as expected. Animations are not only at build time, but Android makes it possible to modify them on runtime and programatically. Stuttering animations don't look good, fading between frames makes the animation more realistic. Overall nice and simple examples are provided which are easy to follow.

Third Chapter deals with the second basic animation technique known as the Tween. Tween is something which has a start point and an endpoint. Tween's start and end point can contain multiple translation points, which are defined by Translate XML element. There are multiple types of Tween and can be combined to create complex animations. The whole chapter explains the making of Tower of Hanoi and the block movements. The chapter later discusses and explains different kinds of animation tween's, the order of the tween's and an infinite tween. Half of the chapter only shows you the animation with single block. Author then switches to multiple sized blocks similar to that of Tower of Hanoi. Animation events are also discussed and gives you a nice introduction. There are different kind of interpolators that make the animations more realistic. Android makes it possible just by setting interpolator type in the layout XML. The last topic deals with these interpolators provided by Android.The next chapter focuses on animation properties and page animation. Page animation is possible using a viewflipper widget. This widget enable flipping between pages as the name suggests. Basically it gives you the ability to turn pages, i.e. you can either move forward or move backwards. Later author introduce you to the ObjectAnimators which are new to Android 3.0. Topics covered within this section shows you to the usage of ValueAnimator with an example of a bouncing ball. The chapter ends with the discussion and usage of interpolators that are used to provide a smooth rhythm too the animation just like tween interpolators.The next chapter is a continuation of the previous chapter and before jumping on to this chapter, you must read the previous one. The chapter discusses advanced animation techniques. In android 3.0 animations more than variable can be assigned animations and they can interact too perform some complex animations. This chapter presents you the multi-variable animation technique with an example of Orrery (Its a mechanical thing, reminds me of  Tomb Raider) along with animation between objects with a TypeEvaluator. In later section, author discusses applying Keyframes, fragments and different Interpolators available in android 3.0.

2D animation is not enough unless it has a depth in it. With Android animation, you can define your objects depth, sometimes known as the z-ordering. Z-axis is the third axis that is pointing inside your screen and hence providing you an illusion of depth. In this chapter, you will learn how a 3D jig-saw is made using the android.graphics API and example for Jig-saw piece swapping. Depth can provide first level of 3 Dimensional effect, but what if two object at different depth overlap each other? It won't look realistic. Shadows bring in startling effects. The example of Jig-saw will show you how shadowing is used in android animation. Along with shadows, you will also learn about setting focus on objects and depth effects. Last topic of this chapter will introduce to the 3D rotations along individual axes, 3D transformations with Camera, etc.

In Chapter 7, high performance animation techniques with surface and game loops is discussed. These techniques are generally used in rendering game graphics. The whole chapter will show you different surface animations to create realistic bubbles. Chapter discusses SurfaceHolders, Canvas locking and unlocking, SurfaceHolder callbacks, and its life cycle. Overall chapter explains advanced techniques in simple language. This chapter is highly recommended for developers who are looking into entering gaming industries.
Chapter 8 is one of the most exciting chapter included in this book. This chapter will teach you how to create live wallpapers using android 3.0. Topics include creating wallpapers from scratch, registering with android.service. WALLPAPER_SERVICE, wallpaper service events, adding events to enable interaction with live wallpapers, using live wallpaper preferences to control wallpaper functions and storing these preferences to preserve settings. Each and every step is wonderfully explained with nice code snippets.

Android offers a number of features that can be efficiently used for developing catchy applications. Even-though the smartphones have evolved, they have limited resources and bad programming can cause extra CPU cycles and resource consumption which may drain out the battery and reduce the life. Chapter 9 focuses upon various do's and dont's that a developer should keep in mind while developing applications for scarce resources. The chapter is self explaining and I am glad that this chapter would prove a great eye opener for amateur programmers. Topics included in this chapter include, realization of unoptimized or excessive animation used in the application, Reducing power usage, Measuring Power usage with Tools such as PowerTutor, idetifying key areas that are power hogging, tracing the hidden or possible bugs and fixing them, etc.

The Extra Stuff

The best IDE available for Android till date is the Eclipse. Though the book source code are Eclipse compatible, author doesn't bar you from using any other IDE. One of such excellent IDE's is IntelliJ IDEA.

This IDE has an inbuilt support for Android and is easy to use and very light weight. You can find more about this IDE at the IntelliJ site.

Secondly, while developing with android 3.0, you will experience a significant performance slow down with the default emulator. Please do not upgrade you hardware for this. ;) The reason behind this performance difference is the emulator uses an unoptimized OpenGL|ES implementation used for generating the catchy graphics. You can find more about this in Android developer forums. If you want to attempt yourself for improving performance then you might want to configure your android emulator to contain a 1024MB of RAM.

Android 3.0 Emulator

To further improve the performance, downgrade your screen size to smaller resolution.

 Likes

  1. This book is perfect for beginners and author has maintained that approach through out this book.

  2. Learning curve is smooth. You will not regret reading this book.

  3. "One example per chapter!" This feature is consistent through out the book. A complete example is explained per chapter introducing to different concepts as you go along.

  4. Pop quiz is adequate, recalls most of the concepts.

  5. Related API calls are explained in tabular format with description and signature.

  6. Each example is compiled with a "What just happened" section to explain the working of the code.

  7. Code examples are highlighted and explained as expected.

  8. The book introduces to the game loop and 3D transformations and rotations. Some user may find it useful while planning their  career in mobile games.

 Dislikes

  1. I completely disagree that the reader should have a previous knowledge of Android. Although the basics are not covered in this book, but author has explained the topics in such a way that a novice programmer can pick up quickly.

  2. First chapter examples and codes might confuse at first but keep in mind they are the basics.

  3. Although Android.gpraphics API is introduced but a small introduction to OpenGL|ES would have made the later topics more exciting.

Tone of the Book

Author uses a very friendly, class room type and clear unambiguous approach while teaching the reader. Author made the reading amusing with technical jokes! So enjoy reading the book.

Concluding Thoughts

Android 3.0 Animation is little late and people are already talking about Andorid 4.0. But, On the brighter side, not many smartphones carry 3.0/4.0, so the time is good to gear up with new animation techniques.

Android animation techniques add intuitive user experience and Android 3.0 inhibits re-inventing the wheels. Stunning animation is now at your fingers.

This book is recommended for developers planning to start their career in games and interactive applications. If you know Java and XML, you are good to go with android animation.

Individual rating for this book:

RATING COMPONENT 

RATING

CONTENT*

10/10

TOPIC EXPLANATION – BASIC*

10/10

TOPIC EXPLANATION – IN-DEPTH*

10/10

TONE OF THE BOOK*

10/10

BEGINNER’S APPROACH*

10/10

RELEVANCE TO THE Android 3.0 Animation*

10/10

CONFUSION CREATED**

0.5/10

MISC FEATURE – Pop Quiz*

9.0/10

GENERAL AUDIENCE LET DOWN**

0.5/10

QUALITY OF EXAMPLES*

9/10

SOURCE CODE*

10/10

Overall Rating for the book

8.0/10

* higher is Better. ** Lower is better.

GPUToaster rates this book 8.0/10.

This book is available from the publishers site, Packt as well as from the major sites such as AmazonBarnes and Nobel.

Android 3.0 Animation by Packt Publishing Ltd.

Android 3.0 Animation by Packt Publishing Ltd.

Read more about:

Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like