Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Learning Android
Search
Denix
September 14, 2017
Programming
0
33
Learning Android
CMRDB Android 讀書會, 2014 Winter
Denix
September 14, 2017
Tweet
Share
More Decks by Denix
See All by Denix
Android_Scalable_Modularized_Testable_Architecture.pdf
denishsieh
0
190
你所不知道所得分配的事
denishsieh
0
44
Git 教學簡報
denishsieh
0
170
Database 教學簡報
denishsieh
0
50
Other Decks in Programming
See All in Programming
ServerAction で Progressive Enhancement はどこまで頑張れるか? / progressive-enhancement-with-server-action
takefumiyoshii
6
500
最近コードレビューで指摘したこと
forrep
3
100
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.5k
Sheets API使ってみた
toshi0383
2
180
Fast JSX: Don't clone props object #28768
yossydev
1
230
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
500
Let's learn code review
riofujimon
2
630
TypeScriptとGraphQLで実現する 型安全なAPI実装 / TSKaigi 2024
hokaccha
5
2.3k
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
2
460
CQRS meets modern Java
simas
PRO
2
450
“Seeing Like a Programmer”—Resiliency, Limits, and Moral Hazards in Software Engineering (LambdaConf 2024)
chriskrycho
0
400
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
240
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
92
4.8k
Unsuck your backbone
ammeep
664
57k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
323
20k
BBQ
matthewcrist
80
8.8k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.7k
A Modern Web Designer's Workflow
chriscoyier
689
190k
In The Pink: A Labor of Love
frogandcode
138
21k
A better future with KSS
kneath
231
16k
What's in a price? How to price your products and services
michaelherold
238
11k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
358
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Transcript
CMRDB 靜宜大學行雲者研發基地 與使用者互動- 事件處理 謝宗翰 Android 讀書會 2014 Winter
2 事件處理機制 button 產生onClick 事件 program
3 來源與監聽物件 ◎來源物件 Ø 事件發生的來源(ex: 按鈕) ◎監聽物件(Listener) Ø 處理該事件 Ø
先登錄à來源物件
4 Interface of Java ◎要成為特定事件的Listener, 必須符合該事 件的規範。 Ø Android à
Interface ü 介面Interface != 使用者介面UI
5 Interface of Java ◎介面(附錄A-20) Ø 一份method的『規格書』 ü 方法的名稱 ü
方法的參數 ü 方法的回傳值 介面 I 類別 C implements 類別 C 具有 介面 I 的功能 methods ….名稱 ….參數 ….回傳值 methods ….內容
6 Implement ◎撰寫符合該介面的method Ø 按一下 onClick() ? ü 在OnClickListener介面已定義 ◎向來源登錄自己成為該事件的Listener
7 Implement public class MainActivity extends Activity implements OnClickListener{ …
protected void onCreate(…){ … Button btn= findViewById(…); btn.setOnClickListener(this); } public void onClick(View v){ … } } 可處理『按一 下』事件 撰寫『按一下』 事件處理方法 取得按鈕 物件 以this向 btn登錄 button 登錄 呼叫
8 The End