Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
@Override
 public boolean onTouchEvent(MotionEvent event) {
  // TODO Auto-generated method stub


  switch(event.getAction()){
  case MotionEvent.ACTION_DOWN:
  case MotionEvent.ACTION_MOVE:
   float x = event.getX();
   float y = event.getY();

   Toast.makeText(this, "Touched@" + x + " : " + y, Toast.LENGTH_LONG).show();
  // ((AndroidDetechTouchActivity)getContext()).updateMsg("Touched@" + x + " : " + y);
   break;
  case MotionEvent.ACTION_UP:
 //  ((AndroidDetechTouchActivity)getContext()).updateMsg("");
   break;
  }

  return true;
 }
Posted

1 solution

make sure if you are running in emulator then you should have to add touch hardware
and if you are using in device then

check the permission you have to use for touch listner
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900