TouchEvent simple Example Code

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

TouchEvent simple Example Code

Postby CHAKYANAS » Sun Mar 23, 2008 3:44 pm

[align=center]Simple TouchEvent Example Code[/align]

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public boolean dispatchTouchEvent(MotionEvent ev){
  2.  
  3.    int action = ev.getAction();
  4.  
  5.    switch(action){
  6.  
  7.       case MotionEvent.ACTION_UP:
  8.  
  9.       int X = (int)ev.getX();
  10.  
  11.       int Y = (int)ev.getY();
  12.  
  13.       checkInRange(X,Y);
  14.  
  15.       if( flag_for_Range==1)
  16.  
  17.          screencordToLat(X,Y);
  18.  
  19.       break;
  20.  
  21.    }
  22.  
  23.    return false;
  24.  
  25. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
User avatar
CHAKYANAS
Developer
Developer
 
Posts: 44
Joined: Mon Mar 03, 2008 5:08 am
Location: INDIA

Top

thanks for this

Postby androidonkey » Mon Mar 31, 2008 9:54 am

CHAKYANAS,

Thanks for this code snippet. It works quite well.

- androidonkey
androidonkey
Junior Developer
Junior Developer
 
Posts: 13
Joined: Mon Feb 18, 2008 10:20 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 10 guests