WEB开发网
开发学院手机开发Android 开发 android实现触摸屏校准 阅读

android实现触摸屏校准

 2010-08-22 04:54:00 来源:WEB开发网   
核心提示:{ "getSwitchState", "(II)I",(void*) android_server_KeyInputQueue_getSwitchStateDevice },{ "getScancodeState", "(I)I",(vo

{ "getSwitchState", "(II)I",

(void*) android_server_KeyInputQueue_getSwitchStateDevice },

{ "getScancodeState", "(I)I",

(void*) android_server_KeyInputQueue_getScancodeState },

{ "getScancodeState", "(II)I",

(void*) android_server_KeyInputQueue_getScancodeStateDevice },

{ "getKeycodeState", "(I)I",

(void*) android_server_KeyInputQueue_getKeycodeState },

{ "getKeycodeState", "(II)I",

(void*) android_server_KeyInputQueue_getKeycodeStateDevice },

{ "hasKeys", "([I[Z)Z",

(void*) android_server_KeyInputQueue_hasKeys },

};

java service 部分: KeyInputQueue.java. 循环查询输入设备信息或目录状态并处理

Thread mThread = new Thread("InputDeviceReader") {

public void run() {

android.os.Process.setThreadPriority(

android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);

try {

RawInputEvent ev = new RawInputEvent();

while (true) {

InputDevice di;

// block, doesn't release the monitor

readEvent(ev);

boolean send = false;

boolean configChanged = false;

......

//检测到新设备后

if (ev.type == RawInputEvent.EV_DEVICE_ADDED) {

synchronized (mFirst) {

di = newInputDevice(ev.deviceId);

mDevices.put(ev.deviceId, di);

configChanged = true;

}

}

//对触摸屏设备

InputDevice.AbsoluteInfo absX;

InputDevice.AbsoluteInfo absY;

InputDevice.AbsoluteInfo absPressure;

InputDevice.AbsoluteInfo absSize;

if ((classes&RawInputEvent.CLASS_TOUCHSCREEN) != 0) {

absX = loadAbsoluteInfo(deviceId, RawInputEvent.ABS_X, "X");

absY = loadAbsoluteInfo(deviceId, RawInputEvent.ABS_Y, "Y");

absPressure = loadAbsoluteInfo(deviceId, RawInputEvent.ABS_PRESSURE,

上一页  1 2 3 4 5 6 7  下一页

Tags:android 实现 触摸屏

编辑录入:coldstar [复制链接] [打 印]
赞助商链接