Learning Android Canvas

If you want to create 2D graphics for Android from scratch, this book is the perfect guide. It covers all the angles of using Android Canvas with a step-by-step approach to give your apps the graphical edge.

Learning Android Canvas

Learning
Mir Nauman Tahir

If you want to create 2D graphics for Android from scratch, this book is the perfect guide. It covers all the angles of using Android Canvas with a step-by-step approach to give your apps the graphical edge.
$17.99
$29.99
RRP $17.99
RRP $29.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free Sample

Book Details

ISBN 139781783285396
Paperback108 pages

About This Book

  • Understand user interactions and respond to those actions
  • Discover how to work with graphics in Android from scratch
  • Using a step by step approach, create a graphics-rich, fully functional application
  • Use Nine-Patch image

Who This Book Is For

This book is a great resource for developers who have basic Android development knowledge and want to work on graphics-rich applications and games but are totally new to working with graphics and Android Canvas.

Table of Contents

Chapter 1: Getting Started with Android Canvas
Android Canvas
Our first Android Canvas application
Mining our first application
Summary
Chapter 2: Drawing Threads
The need for drawing threads
The issue with multithreading in Android
The Thread class
Summary
Chapter 3: Drawing and Drawables in Android Canvas
Drawing on a Canvas
Shape Drawables
Summary
Chapter 4: NinePatch Images
Creating a NinePatch image
Using a NinePatch image
Summary
Chapter 5: Touch Events and Drawing on Canvas
Some background knowledge
Application development
Summary
Chapter 6: Putting it All Together
The story board
The project and application development
Summary

What You Will Learn

  • Create a drawable thread to take away the load from the main thread
  • Develop important drawables and shapes
  • Understand the actions performed by users, capturing them, and responding to them
  • Unfold the basics of nested layouts
  • Design your own View classes and use them in the main class
  • Discover the graphics used as backgrounds of the whole screen or controls like buttons
  • Draw on the Android Canvas and Views
  • Set up the listener for touch events

In Detail

When you're writing an application in which you would like to perform specialized drawing and/or control the animation of graphics, you should do so by drawing through a canvas. A canvas works for you as an interface to the actual surface upon which your graphics will be drawn — it holds all of your "draw" calls. Via the Android Canvas, your drawing is actually performed on an underlying Bitmap, which is placed into the window.

Learning Android Canvas is a practical guide, which will help you develop applications that contain rich 2D graphics like backgrounds, buttons, and even some small games with static 2D graphics. The book is full of step-by-step lessons and practical examples. This book helps you develop rich graphical applications and some simple games.

Learning Android Canvas will help you understand everything that is required to develop an Android application that involves creating 2D graphics from scratch to a fully functional complete application. You will start with zero knowledge of using graphics within Android applications and will then go step by step to learn about different objects and techniques. In the end you will be able to develop a complete application fully loaded with graphics and functions.

The book will give you a detailed practical explanation of Nine-Patch images and its importance in designing layouts and backgrounds. We will also take a detailed look at user interactions such as touch, capturing the action, and responding to them accordingly. Finally we will have a working, fully functional graphic application that uses all the knowledge that we have acquired previously.

Authors

Table of Contents

Chapter 1: Getting Started with Android Canvas
Android Canvas
Our first Android Canvas application
Mining our first application
Summary
Chapter 2: Drawing Threads
The need for drawing threads
The issue with multithreading in Android
The Thread class
Summary
Chapter 3: Drawing and Drawables in Android Canvas
Drawing on a Canvas
Shape Drawables
Summary
Chapter 4: NinePatch Images
Creating a NinePatch image
Using a NinePatch image
Summary
Chapter 5: Touch Events and Drawing on Canvas
Some background knowledge
Application development
Summary
Chapter 6: Putting it All Together
The story board
The project and application development
Summary

Book Details

ISBN 139781783285396
Paperback108 pages
Read More