SlideShare una empresa de Scribd logo
1 de 13
Android
Touch
Android Training
By Khaled Anaqwa
Android touch basics
 The Android standard View class support
touch events.
 You can react to touch events in your
custom views and your activities.
 Android supports multiple pointers, e.g.
fingers which are interacting with the
screen.
 The base class for touch support is the
MotionEvent class which is passed to
Views via the onTouchEvent() method.
 To react to touch events you override the
onTouchEvent() method.
Single touch
 If single input is used you can use the
getX() and getY() methods to get the
current position of the first finger.
 Via the getAction() method you receive
the action which was performed
The MotionEvent class provides the following
constants to determine the action which was
performed.
Demo
 Using One Touch
 Create custom View
 Draw in it
 Track touches points
 Draw lines while move
Task
 Draw dot’s and connects these dot’s on
screen
Gestures
 Android provides special types of touch
screen events such as pinch , double tap,
scrolls , long presses and flinch. These are
all known as gestures.
 Android provides GestureDetector class
to receive motion events and tell us that
these events correspond to gestures or
not.
Using
 you need to create an object of
GestureDetector and then extend
another class with
GestureDetector.SimpleOnGestureListener
to act as a listener.
Gestures Type
 Touch
 Long press
 Swipe or drag
 Long press drag
 Double touch (Tap)
 Pinch open / close
Where I can use onTouch
Listener
 onTouchEvent (Activity Override)
 onTouchEvent (CustomView Override)
 onTouch(view.setOnTouchListener)
Demo
 Use GestureDetector.
SimpleOnGestureListener
Task
 Create Listview and implement Swipe to
delete

Más contenido relacionado

Destacado

Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)Khaled Anaqwa
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_androidPRITI TELMORE
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Khaled Anaqwa
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)Khaled Anaqwa
 
Wifi direct p2p app
Wifi direct p2p appWifi direct p2p app
Wifi direct p2p appgeniushkg
 
Chapter 3 storage media and devices
Chapter 3   storage media and devicesChapter 3   storage media and devices
Chapter 3 storage media and devicesPratik Gupta
 
Chapter 8 system analysis and design
Chapter 8   system analysis and designChapter 8   system analysis and design
Chapter 8 system analysis and designPratik Gupta
 
Introduction to Wi-Fi Direct
Introduction to Wi-Fi DirectIntroduction to Wi-Fi Direct
Introduction to Wi-Fi DirectWei-Tsung Su
 
Smartphone sensor and gesture
Smartphone sensor and gestureSmartphone sensor and gesture
Smartphone sensor and gestureBhavya5800
 
C hapter 1 types-and_components_of_computer_system[1][1]
C hapter 1   types-and_components_of_computer_system[1][1]C hapter 1   types-and_components_of_computer_system[1][1]
C hapter 1 types-and_components_of_computer_system[1][1]Pratik Gupta
 
Android sensors
Android sensorsAndroid sensors
Android sensorsdatta_jini
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast ReceiverYong Heui Cho
 
Android - Sensor Manager
Android - Sensor ManagerAndroid - Sensor Manager
Android - Sensor ManagerYong Heui Cho
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007crespoje
 

Destacado (20)

Android Training (Animation)
Android Training (Animation)Android Training (Animation)
Android Training (Animation)
 
MS Access Training
MS Access TrainingMS Access Training
MS Access Training
 
Uses of MS Access in Business
Uses of MS Access in BusinessUses of MS Access in Business
Uses of MS Access in Business
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
 
Wi-Fi Direct
Wi-Fi DirectWi-Fi Direct
Wi-Fi Direct
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
 
Wifi direct p2p app
Wifi direct p2p appWifi direct p2p app
Wifi direct p2p app
 
Android Sensor System
Android Sensor SystemAndroid Sensor System
Android Sensor System
 
Chapter 3 storage media and devices
Chapter 3   storage media and devicesChapter 3   storage media and devices
Chapter 3 storage media and devices
 
Chapter 8 system analysis and design
Chapter 8   system analysis and designChapter 8   system analysis and design
Chapter 8 system analysis and design
 
Introduction to Wi-Fi Direct
Introduction to Wi-Fi DirectIntroduction to Wi-Fi Direct
Introduction to Wi-Fi Direct
 
Smartphone sensor and gesture
Smartphone sensor and gestureSmartphone sensor and gesture
Smartphone sensor and gesture
 
C hapter 1 types-and_components_of_computer_system[1][1]
C hapter 1   types-and_components_of_computer_system[1][1]C hapter 1   types-and_components_of_computer_system[1][1]
C hapter 1 types-and_components_of_computer_system[1][1]
 
Android Sensor
Android SensorAndroid Sensor
Android Sensor
 
Android sensors
Android sensorsAndroid sensors
Android sensors
 
Android - Broadcast Receiver
Android - Broadcast ReceiverAndroid - Broadcast Receiver
Android - Broadcast Receiver
 
Android - Sensor Manager
Android - Sensor ManagerAndroid - Sensor Manager
Android - Sensor Manager
 
Ms access
Ms accessMs access
Ms access
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007
 

Similar a Android Training (Touch)

Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Vu Tran Lam
 
Multi Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And TypesMulti Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And TypesEthan Cha
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design Rakesh Jha
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application DevelopmentMuhammad Sajid
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentationsenthil0809
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docPalakjaiswal43
 
Flash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listFlash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listSmall Screen Design
 
Project presentation -chady abidi
Project presentation -chady abidiProject presentation -chady abidi
Project presentation -chady abidichadyabidi
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sitesAspenware
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sitesAspenware
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFXjavafxpert
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03Ankit Dubey
 
Developing accessible android applications
Developing accessible android applicationsDeveloping accessible android applications
Developing accessible android applicationsRenato Iwashima
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 

Similar a Android Training (Touch) (20)

Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures
 
Android user interface design-chapter13
Android user interface design-chapter13Android user interface design-chapter13
Android user interface design-chapter13
 
Multi Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And TypesMulti Touch And Gesture Event Interface And Types
Multi Touch And Gesture Event Interface And Types
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
Take a Ride on the Metro
Take a Ride on the MetroTake a Ride on the Metro
Take a Ride on the Metro
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Flash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listFlash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic list
 
Interactive Screen
Interactive ScreenInteractive Screen
Interactive Screen
 
Mie presentation
Mie presentationMie presentation
Mie presentation
 
Project presentation -chady abidi
Project presentation -chady abidiProject presentation -chady abidi
Project presentation -chady abidi
 
Mobile Application Development class 005
Mobile Application Development class 005Mobile Application Development class 005
Mobile Application Development class 005
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sites
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sites
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03
 
Developing accessible android applications
Developing accessible android applicationsDeveloping accessible android applications
Developing accessible android applications
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 

Más de Khaled Anaqwa

Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Khaled Anaqwa
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)Khaled Anaqwa
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)Khaled Anaqwa
 
Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Khaled Anaqwa
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)Khaled Anaqwa
 
Android Training (Intro)
Android Training (Intro)Android Training (Intro)
Android Training (Intro)Khaled Anaqwa
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)Khaled Anaqwa
 

Más de Khaled Anaqwa (7)

Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)
 
Android Training (Sensors)
Android Training (Sensors)Android Training (Sensors)
Android Training (Sensors)
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)
 
Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Android Training (Intro)
Android Training (Intro)Android Training (Intro)
Android Training (Intro)
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Último (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Android Training (Touch)

  • 2. Android touch basics  The Android standard View class support touch events.  You can react to touch events in your custom views and your activities.  Android supports multiple pointers, e.g. fingers which are interacting with the screen.
  • 3.  The base class for touch support is the MotionEvent class which is passed to Views via the onTouchEvent() method.  To react to touch events you override the onTouchEvent() method.
  • 4. Single touch  If single input is used you can use the getX() and getY() methods to get the current position of the first finger.  Via the getAction() method you receive the action which was performed
  • 5. The MotionEvent class provides the following constants to determine the action which was performed.
  • 6. Demo  Using One Touch  Create custom View  Draw in it  Track touches points  Draw lines while move
  • 7. Task  Draw dot’s and connects these dot’s on screen
  • 8. Gestures  Android provides special types of touch screen events such as pinch , double tap, scrolls , long presses and flinch. These are all known as gestures.  Android provides GestureDetector class to receive motion events and tell us that these events correspond to gestures or not.
  • 9. Using  you need to create an object of GestureDetector and then extend another class with GestureDetector.SimpleOnGestureListener to act as a listener.
  • 10. Gestures Type  Touch  Long press  Swipe or drag  Long press drag  Double touch (Tap)  Pinch open / close
  • 11. Where I can use onTouch Listener  onTouchEvent (Activity Override)  onTouchEvent (CustomView Override)  onTouch(view.setOnTouchListener)
  • 13. Task  Create Listview and implement Swipe to delete