Chapter 5. The Android Canvas Class – Drawing to the Screen

While we will leave creating our own classes for a few more chapters our new-found knowledge about methods enables us to start taking greater advantage of the classes that Android provides. This entire chapter will be about the Android Canvas class and some related classes like Paint and Color. These classes combined bring great power when it comes to drawing to the screen. Learning about Canvas will also teach us the basics of using any class.

In this chapter, we will:

  • Talk about understanding the Canvas and related classes
  • Write a Canvas based demo app as practice before moving on to Sub' Hunter
  • Look at the Android coordinate system so we know where to do our drawing
  • Draw some graphics ...

Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.