SlideShare a Scribd company logo
3
Most read
MOBILE APPLICATION
DEVELOPMENT
LECTURE – 05
By: AbuBakar Ubaid
EVENT HANDLING
By: AbuBakar Ubaid
Android - Event Handling
• Event Listeners − An event listener is an interface in the View
class that contains a single callback method.These methods
will be called by the Android framework when the View to
which the listener has been registered is triggered by user
interaction with the item in the UI.
• Event Listeners Registration − Event Registration is the
process by which an Event Handler gets registered with an
Event Listener so that the handler is called when the Event
Listener fires the event.
• Event Handlers − When an event happens and we have
registered an event listener for the event, the event listener
calls the Event Handlers, which is the method that actually
handles the event.
3
OnClickListener() and onClick()
//---Button view---
Button btnOpen = (Button)
findViewById(R.id.btnOpen);
btnOpen.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DisplayToast(“You have clicked the Open button”);
}
});
4
Event Handler Event Listener & Description
onClick()
OnClickListener()
This is called when the user either clicks or touches or
focuses upon any widget like button, text, image etc. You
will use onClick() event handler to handle such event.
onLongClick()
OnLongClickListener()
This is called when the user either clicks or touches or
focuses upon any widget like button, text, image etc. for one
or more seconds. You will use onLongClick() event handler
to handle such event.
onFocusChange()
OnFocusChangeListener()
This is called when the widget looses its focus ie. user goes
away from the view item. You will use onFocusChange()
event handler to handle such event.
onKey()
OnFocusChangeListener()
This is called when the user is focused on the item and
presses or releases a hardware key on the device. You will
use onKey() event handler to handle such event.
5
6
Event Handler Event Listener & Description
onTouch()
OnTouchListener()
This is called when the user presses the key, releases
the key, or any movement gesture on the screen. You
will use onTouch() event handler to handle such
event.
onMenuItemClick()
OnMenuItemClickListener()
This is called when the user selects a menu item. You
will use onMenuItemClick() event handler to handle
such event.
onCreateContextMenu()
onCreateContextMenuItemListener()
This is called when the context menu is being
built(as the result of a sustained "long click)
LIST VIEW
By: AbuBakar Ubaid
ListView View
• The ListView
displays a list of
items in a
vertically
scrolling list.
8
THANK YOU 
LECTURE – 05 “Event Handling & List View”
By: AbuBakar Ubaid

More Related Content

PPTX
Event Handling in Mobile Application Development.pptx
PPTX
Androd Listeners
DOCX
Android user interface design-chapter13
PPTX
Event handling in Java(part 1)
PPTX
EventListenerInAndroidDevelopmentII.pptx
PPTX
What is Event
PPTX
Event Handling in JAVA
PPTX
Event Handling in Java
Event Handling in Mobile Application Development.pptx
Androd Listeners
Android user interface design-chapter13
Event handling in Java(part 1)
EventListenerInAndroidDevelopmentII.pptx
What is Event
Event Handling in JAVA
Event Handling in Java

Similar to Mobile Application Development (20)

PPTX
tL20 event handling
PDF
Ajp notes-chapter-03
PPT
Chapter 8 event Handling.ppt m m m m m m
PDF
Session 12 - Overview of taps, multitouch, and gestures
PPTX
Android App development III
PPT
Java eventhandling
PDF
Events and Listeners in Android
PPTX
JAVA UNIT 5.pptx jejsjdkkdkdkjjndjfjfkfjfnfn
PPTX
B2. activity and intent
DOC
ANDROID LAB MANUAL.doc
PDF
java-programming GUI- Event Handling.pdf
PDF
Event Handling in Java as per university
PPT
Unit 6 Java
PPTX
File Handling
PPT
Java gui event
PDF
Java Programming :Event Handling(Types of Events)
PPTX
ITE 1122_ Event Handling.pptx
PDF
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
PPTX
Android Mobile application development - Event Handling (1).pptx
PDF
Unity UI and Compatibility Testing Content.pdf
tL20 event handling
Ajp notes-chapter-03
Chapter 8 event Handling.ppt m m m m m m
Session 12 - Overview of taps, multitouch, and gestures
Android App development III
Java eventhandling
Events and Listeners in Android
JAVA UNIT 5.pptx jejsjdkkdkdkjjndjfjfkfjfnfn
B2. activity and intent
ANDROID LAB MANUAL.doc
java-programming GUI- Event Handling.pdf
Event Handling in Java as per university
Unit 6 Java
File Handling
Java gui event
Java Programming :Event Handling(Types of Events)
ITE 1122_ Event Handling.pptx
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
Android Mobile application development - Event Handling (1).pptx
Unity UI and Compatibility Testing Content.pdf
Ad

More from Muhammad Sajid (20)

PPTX
eCommerce App Lecture
PPTX
Characteristics of enterprise application software
PPTX
The Checkout and Order Process
PPTX
The Shopping Basket
PPTX
Enhancing the User Experience
PPTX
Products and Categories
PPTX
E-Commerce Applications Development
PPTX
E-Commerce Applications Development
PPTX
Data Transfer between Activities & Databases
PPTX
Data Transfer between Activities & Databases
PPTX
Data Transfer between Activities & Databases
PDF
MOBILE APPLICATION DEVELOPMENT
PDF
MOBILE APPLICATION DEVELOPMENT
PDF
MOBILE APPLICATION DEVELOPMENT
PDF
MOBILE APPLICATION DEVELOPMENT
PPTX
Your first Android App
PPTX
Group Aided Decision making revised
PDF
Pakistan Studies notes
PDF
Components of Computing Game
PDF
Design Elements of Computing Game
eCommerce App Lecture
Characteristics of enterprise application software
The Checkout and Order Process
The Shopping Basket
Enhancing the User Experience
Products and Categories
E-Commerce Applications Development
E-Commerce Applications Development
Data Transfer between Activities & Databases
Data Transfer between Activities & Databases
Data Transfer between Activities & Databases
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
MOBILE APPLICATION DEVELOPMENT
Your first Android App
Group Aided Decision making revised
Pakistan Studies notes
Components of Computing Game
Design Elements of Computing Game
Ad

Recently uploaded (20)

PPTX
master seminar digital applications in india
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Lesson notes of climatology university.
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Complications of Minimal Access Surgery at WLH
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Institutional Correction lecture only . . .
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Pre independence Education in Inndia.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
master seminar digital applications in india
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial disease of the cardiovascular and lymphatic systems
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Lesson notes of climatology university.
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Sports Quiz easy sports quiz sports quiz
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Complications of Minimal Access Surgery at WLH
Supply Chain Operations Speaking Notes -ICLT Program
Microbial diseases, their pathogenesis and prophylaxis
Institutional Correction lecture only . . .
PPH.pptx obstetrics and gynecology in nursing
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Pre independence Education in Inndia.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

Mobile Application Development

  • 3. Android - Event Handling • Event Listeners − An event listener is an interface in the View class that contains a single callback method.These methods will be called by the Android framework when the View to which the listener has been registered is triggered by user interaction with the item in the UI. • Event Listeners Registration − Event Registration is the process by which an Event Handler gets registered with an Event Listener so that the handler is called when the Event Listener fires the event. • Event Handlers − When an event happens and we have registered an event listener for the event, the event listener calls the Event Handlers, which is the method that actually handles the event. 3
  • 4. OnClickListener() and onClick() //---Button view--- Button btnOpen = (Button) findViewById(R.id.btnOpen); btnOpen.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { DisplayToast(“You have clicked the Open button”); } }); 4
  • 5. Event Handler Event Listener & Description onClick() OnClickListener() This is called when the user either clicks or touches or focuses upon any widget like button, text, image etc. You will use onClick() event handler to handle such event. onLongClick() OnLongClickListener() This is called when the user either clicks or touches or focuses upon any widget like button, text, image etc. for one or more seconds. You will use onLongClick() event handler to handle such event. onFocusChange() OnFocusChangeListener() This is called when the widget looses its focus ie. user goes away from the view item. You will use onFocusChange() event handler to handle such event. onKey() OnFocusChangeListener() This is called when the user is focused on the item and presses or releases a hardware key on the device. You will use onKey() event handler to handle such event. 5
  • 6. 6 Event Handler Event Listener & Description onTouch() OnTouchListener() This is called when the user presses the key, releases the key, or any movement gesture on the screen. You will use onTouch() event handler to handle such event. onMenuItemClick() OnMenuItemClickListener() This is called when the user selects a menu item. You will use onMenuItemClick() event handler to handle such event. onCreateContextMenu() onCreateContextMenuItemListener() This is called when the context menu is being built(as the result of a sustained "long click)
  • 8. ListView View • The ListView displays a list of items in a vertically scrolling list. 8
  • 9. THANK YOU  LECTURE – 05 “Event Handling & List View” By: AbuBakar Ubaid