Handling Events

Now that we've seen the basics of canvas drawing and we've our custom view adapted to its size, it's time to interact with it. Many custom views will only need to draw something in a special way; that's the reason we created them as custom views, but many others will need to react to user events. For example, how our custom view will behave when the user clicks or drags on top of it?

To answer these questions, we'll cover with more detail the following points in this chapter:

  • Basic event handling
  • Advanced event handling

Get Building Android UIs with Custom Views 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.