-2

I'm trying to program a Mouse via Wifi TCP. Client is on Android and Server on Java. I'm trying to detect a LongPress on Android and send this information to Java.

Android: I need to implement MotionEvent.ACTION_DOWN but I don´t know what to do after this code.

Java: How the class Robot receive those parameters who MotionEvent sends, and how implement the LongPress on both client and server.

Ram
  • 3,092
  • 10
  • 40
  • 56
  • 1
    You need to learn a lot more about android/java/etc before you continue. Your questions are very basic and show that you should complete a full tutorial on both subjects before continuing. – KevinDTimm Jun 16 '15 at 18:39
  • possible duplicate of [Android : How to implement longpress manually in touch event?](http://stackoverflow.com/questions/10047531/android-how-to-implement-longpress-manually-in-touch-event) – josedlujan Jun 17 '15 at 00:57

2 Answers2

0
if(motionEvent.isActionDown())
    new Handler().postDelayed(new Runnable(){
     public void run(){
          onLongPressListener.fire();
     }
  }, 500);

You can send as messages delayeds and clear the messages with an ID.

Marcos Vasconcelos
  • 18,136
  • 30
  • 106
  • 167
0

You could use a button.setonlongclicklistener? Check out this example: http://androidbite.blogspot.com/2013/03/android-long-press-event-handle-example.html

Susheel
  • 784
  • 1
  • 12
  • 20