Professional Documents
Culture Documents
Lect6 - Events
Lect6 - Events
Material Design
2
Last Week’s Tasks
Complete developing the following screens
3
In this Lecture
Event Handling
Listener objects
Anonymous inner objects
Use of lambdas in event handlers
4
Events: What are they?
5
Events: What are they?
7
Setting up a listener
8
Setting up a listener
The setOnClickListener is a member my_button.setOnClickListener(object:
function of the android.view.View class View.OnClickListener {
override fun onClick(v: View?) {
This function expects an OnClickListener // do something
object as an argument—this object }
becomes the listener for the button control })
fun do_something(v:View?){
// do something here
}
<Button
android:id="@+id/button"
android:onClick="do_something"
android:text="Button"/>
10
Tasks for this week
Implement the following sequence of interfaces (Tapping on components circled in blue should take you to next screen)
11
Tasks for this week
Implement the following sequence of interfaces (Tapping on components circled in blue should take you to next screen)
12
Tasks for this week
Implement the following sequence of interfaces (Tapping on components circled in blue should take you to next screen)
13
Tasks for this week
Implement the following sequence of interfaces (Tapping on components circled in blue should take you to next screen)
14