Learning Android Canvas


Learning Android Canvas
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
$15.29
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
$29.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 108 pages [ 235mm x 191mm ]
Release Date : November 2013
ISBN : 1783285397
ISBN 13 : 9781783285396
Author(s) : Mir Nauman Tahir
Topics and Technologies : All Books, Application Development, Web Development, Open Source

Table of Contents

Preface
Chapter 1: Getting Started with Android Canvas
Chapter 2: Drawing Threads
Chapter 3: Drawing and Drawables in Android Canvas
Chapter 4: NinePatch Images
Chapter 5: Touch Events and Drawing on Canvas
Chapter 6: Putting it All Together
Index
  • Chapter 1: Getting Started with Android Canvas
    • Android Canvas
    • Our first Android Canvas application
      • Application Name
      • Project Name
      • Package Name
      • Least possible version of SDK
      • Target SDK
      • Theme
    • Mining our first application
      • The configuration file
      • The layout file
      • The code file
    • Summary
    • Chapter 2: Drawing Threads
      • The need for drawing threads
      • The issue with multithreading in Android
      • The Thread class
        • Handler objects that run on the UI thread
        • AsyncTask
      • Summary
          • Chapter 5: Touch Events and Drawing on Canvas
            • Some background knowledge
            • Application development
              • Our custom-view class
                • Defining class properties and objects
                • Methods in our custom-view class
                • The constructor
                • The drawing method
                • The measurement method
                • The touch event
              • Our main activity class and final output
            • Summary
            • Chapter 6: Putting it All Together
              • The story board
              • The project and application development
                • The user interface
                  • Screen orientation
                  • The paint brush
                  • Designing the Control panel
                  • Setting up the layout
                • Enabling the touch and painting using touch
                • Enabling the color selection
                • Spicing up our application with more functions
                  • Saving the painting
                  • Creating a new drawing
                  • Enabling eraser in our application
              • Summary

              Mir Nauman Tahir

              Mir Nauman Tahir completed his MS in Information Technology from Khyber Pakhtoonkhwa, Pakistan. He specialized in web technologies. He is also a Microsoft Certified Technology Specialist. He started his professional programming career in 2004 and has worked on developing different systems, such as Library Management System, Procurement System, a lot of web applications, and dynamic websites with content management systems. Mir worked on the Android source code for almost 1.5 years in a research group as a developer and published a research paper on the basis of his research with that team. Mir has also worked on other open source technologies such as OpenERP, PostGre-SQL, and different flavors of Linux. Mir currently has more than eight years of industry experience consisting majorly of in-house development for some of Pakistan's most well reputed organizations and universities. He started his career as a Software Engineer for COMSATS Institute of Information Technology, Abbottabad, Pakistan and has since worked with Security Engineering Research Group, Peshawar, Pakistan; UN-HABITAT, Pakistan; Save the Children, Pakistan; and currently working as an Information Management Officer in a well-reputed humanitarian organization in Pakistan. This is Mir's first book, but he writes most of his technical articles on his personal blog, http://mirnauman.wordpress.com. The articles are mostly about Android and Microsoft .Net technologies. Mir loves sketching and playing computer games.

              Code Downloads

              Download the code and support files for this book.


              Submit Errata

              Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

              Sample chapters

              You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

              Frequently bought together

              Learning Android Canvas +    Selenium 2 Testing Tools: Beginner’s Guide =
              50% Off
              the second eBook
              Price for both: £20.45

              Buy both these recommended eBooks together and get 50% off the cheapest eBook.

              What you will learn from this book

              • 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.

              Approach

              This book is a fast-paced, practical, step-by-step tutorial guide full of examples that are easy to follow and implement.

              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.

              Code Download and Errata
              Packt Anytime, Anywhere
              Register Books
              Print Upgrades
              eBook Downloads
              Video Support
              Contact Us
              Awards Voting Nominations Previous Winners
              Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
              Resources
              Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software