Jump to content

[Android]Recognise if screen was touched

- - - - -

  • Please log in to reply
1 reply to this topic

#1
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
I thought lets post this small code snippter because i oftean forget how to do it myself.. :)

The comments are explaining what the ACTION_DOWN for example means.


public boolean onTouchEvent(MotionEvent e, MapView mv){

        int i = e.getAction();


        switch(i){


        case MotionEvent.ACTION_DOWN:

            //When your finger touches the screen


            break;


        case MotionEvent.ACTION_UP:

            //When your finger stop touching the screen


            break;


        case MotionEvent.ACTION_MOVE:

            //When your finger moves around the screen


            break;

        }


        return false;

    }


My blogg has some Android tutorials for the people who are intrested: TheCompBoy
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#2
iNinjaDJ

iNinjaDJ

    Newbie

  • Members
  • Pip
  • 2 posts
Awesome blog mate :P




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users