Book Image

Android 3.0 Animations: Beginner's Guide

By : Alex Shaw
Book Image

Android 3.0 Animations: Beginner's Guide

By: Alex Shaw

Overview of this book

<p>An enjoyable, understandable, and eye-catching user interface is a key part of getting users to love your app. Users today expect a polished multimedia experience on their mobile device, and animation is a core part of that. The Android operating system is at the forefront of tablet and smartphone technology, and there is a plethora of opportunities for developing exciting applications with animation.</p> <p>Android 3.0 Animations Beginner’s Guide will introduce each of the most popular animation techniques to you. Using step-by-step instructions, you will learn how to create interactive dynamic forms, moving graphics, and 3D motion.</p> <p>You will be taken on a journey from simple stop motion animations and fades, through to moving input forms, then on to 3D motion and game graphics.</p> <p>In this book, you will create standalone animated graphics, three-dimensional lifts, fades, and spins. You will become adept at moving and transforming form data to bring boring old input forms and displays to life. Learn how game programmers create fast animations on the fly, and also build live wallpapers to liven up your users’ home-screens!</p> <p>If you are tired of writing lifeless interfaces and want to add some animated excitement, this is the book for you!</p>
Table of Contents (16 chapters)
Android 3.0 Animations
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Preface

Android 3.0 Animation, a Beginner's Guide, will introduce each of the most popular animation techniques to you as an Android developer. Using step-by-step instructions, you will learn how to create interactive dynamic forms, moving graphics, and 3D motion.

You will be taken on a journey from simple stop motion animations and fades through to moving input forms, and then on to 3D motion and game graphics. In this book we will create standalone animated graphics, three-dimensional lifts, fades, and spins. You will become adept at moving and transforming form data to bring boring old input forms and displays to life.

What this book covers

Chapter 1, Animation Techniques on Android, is a guided tour of the diverse possibilities for animating content on Android.

Chapter 2, Frame Animations, teaches you to create and control animations that are composed of a series of still images.

Chapter 3, Tweening and Using Animators, adds animated life to the Views in your Android application.

Chapter 4, Animating Properties and Tweening Pages, introduces some more specialized animation capabilities, available in Android.

Chapter 5, Creating Classes for Tween Animation, shows you how to take control of the low-level behaviors of your animations to create new and distinctive movements.

Chapter 6, Using 3D Visual Techniques, takes techniques that we introduced in previous chapters and shows you how to use them to create 3D depth and rotation effects.

Chapter 7, 2D Graphics with Surfaces, introduces programmatic animations that you draw onto a blank canvas. This technique is ideal for writing games and advanced visualizations.

Chapter 8, Live Wallpapers, shows you how to build your animations into one of Android's most distinctive graphical features wallpapers that move.

Chapter 9, Practicing Good Practice and Style, shows you how animation can be used to make your application better looking and easier to use, as well as looking at the performance cost of animated graphics.

What you need for this book

You should know how to program in Java and have experience using the Android SDK to make Android applications. You should understand basic object-oriented programming and know how to run your code on an Android device. You should also understand that Android uses XML files to show Views on screen.

You will require a computer that has the Android SDK installed and which has the Android 3.0 packages. You will also need a tool for entering the example code, compiling it, and deploying to an Android device or emulator. For this purpose, the book has been written with Eclipse users in mind, but the concepts and code presented will work equally well in IntelliJ IDEA or any other Android development environment that you are familiar with.

Because the Android applications in this book can be run on real devices, you may want to have an Android 3.0-compatible device, or higher. This is not necessary, but it is much more fun!

Who this book is for

If you are familiar with developing Android applications and want to bring your apps to life by adding smashing animations, then this book is for you. This book assumes that you are comfortable with Java development and have familiarity with creating Android Views in XML and Java. The tutorials assume that you will want to work with Eclipse, but you can work just as well with your preferred development tools.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action - heading

  1. 1. Action 1

  2. 2. Action 2

  3. 3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz - heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Get the example android project, CountDroid, from the code bundle and compile it to an Android APK for deploying to a device."

A block of code is set as follows:

package com.packt.animation.viewexample;
import android.app.Activity;
import android.os.Bundle;
public class ViewExample extends Activity {
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyTextView helloView = new MyTextView(this);
helloView.setText("Hello Views!");
setContentView(helloView);
}
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<ImageView
android:id="@+id/stickman"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@anim/stickman"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
>

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " Download the APK you built to your favorite emulator or Android device, and launch the Counting Calculator activity.".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.