package com.android.jim;
import android.app.Instrumentation;
import android.os.SystemClock;
import android.view.MotionEvent;
import anywheresoftware.b4a.BA.ShortName;
@ShortName("SendInput")
public class SendInput {
Instrumentation m=new Instrumentation();
/**
* Send a single keystroke
*/
public void SendKeyPress(int Keycode){
m.sendKeyDownUpSync(Keycode);
}
/**
* Send a touch action to location <b>X</b> , <b>Y</b>.
* <b>Action</b> should be one of the following:
* <b>ACTION_DOWN</b> - Send the touch down action
* <b>ACTION_UP</b> - Send the touch up action
* <b>ACTION_MOVE</b> - Send the touch move action
*/
public void SendTouchAction(int Action,float X,float Y){
final long millis = SystemClock.uptimeMillis();
m.sendPointerSync(MotionEvent.obtain(millis,millis,Action,X,Y,0));
}
};