- 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
- Mastering ServiceStack
- SQL Server 2012數據庫技術及應用(微課版·第5版)
- Android 9 Development Cookbook(Third Edition)
- 你不知道的JavaScript(中卷)
- Flux Architecture
- Apache Mahout Clustering Designs
- SpringBoot從零開始學(視頻教學版)
- Python計算機視覺和自然語言處理
- SwiftUI極簡開發
- Sails.js Essentials
- 大學計算機應用基礎(Windows 7+Office 2010)(IC3)
- 程序員的成長課
- Python全棧開發:數據分析
- HTML5+CSS3+JavaScript案例實戰
- C#網絡程序開發(第二版)