- Hands-On Android UI Development
- Jason Morris
- 209字
- 2021-07-02 23:26:09
Taking Actions
Handling events is an essential part of any application; they are the raw input data for a user interface and how we interact with our users (rather than just presenting them with data). Android has an event model that will be instantly familiar to anyone who has programmed Java on their desktop--you attach listener objects to the widgets, and they deliver events to you.
Event listeners in Android take the form of interfaces that you need to implement in order to receive the events. Each possible event type is declared as a method on the relevant interface. To receive a notification that the user has clicked or tapped on a widget, you use the OnClickListener interface, which declares a method--onClick(View)--which will be invoked when the relevant widget receives what it considers a click gesture from the user.
In this chapter, we'll take a look at events on Android, and how best to implement them. Specifically, we'll be taking a closer look at the following:
- How Android dispatches events, and how it affects your program and user experience
- Different ways to implement event listeners and their pros and cons
- How to wrap groups of events into logical classes
- How to make events always happen quickly
- Python數據可視化:基于Bokeh的可視化繪圖
- 單片機C語言程序設計實訓100例:基于STC8051+Proteus仿真與實戰
- 深入實踐Spring Boot
- C# 從入門到項目實踐(超值版)
- Hands-On C++ Game Animation Programming
- VMware虛擬化技術
- 零基礎輕松學SQL Server 2016
- Java EE 8 Application Development
- Learning JavaScript Data Structures and Algorithms(Second Edition)
- 從零開始學Android開發
- PHP與MySQL權威指南
- Python Web自動化測試設計與實現
- Java EE架構設計與開發實踐
- Python 3快速入門與實戰
- 程序員必會的40種算法