HTML5 Drag and Drop API on Touch Screen Devices

There are some native HTML5 Events that works in WebKit (Chrome & Safari) … only mobile versions. The name of these events are touchstart, touchmove, touchend, touchcancel An example to reposition an element with touch is: $(document).bind(“touchstart”, function(e) { e.preventDefault(); var orig = e.originalEvent; var x = orig.changedTouches[0].pageX; var y = orig.changedTouches[0].pageY; $(“#element”).css({top: y, left: … Read more

How to determine if an Android device has a touchscreen?

You should research the existing devices and read the Android Compatibility Definition Document (CDD) and decide for yourself. I have spent some considerable time trying to figure out this problem for myself. The posters above are correct that Android already powers some non-touch devices and will power Google TV in the near future, but as … Read more

JavaScript mapping touch events to mouse events

I am sure this is what you want: function touchHandler(event) { var touches = event.changedTouches, first = touches[0], type = “”; switch(event.type) { case “touchstart”: type = “mousedown”; break; case “touchmove”: type = “mousemove”; break; case “touchend”: type = “mouseup”; break; default: return; } // initMouseEvent(type, canBubble, cancelable, view, clickCount, // screenX, screenY, clientX, clientY, … Read more

Simulating mouse input programmatically in OS X

Yes, it is possible. You can use the Quartz Event Services to simulate input events. Assuming C, I wrote this quick example: #include <ApplicationServices/ApplicationServices.h> #include <unistd.h> int main() { // Move to 200×200 CGEventRef move1 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, CGPointMake(200, 200), kCGMouseButtonLeft // ignored ); // Move to 250×250 CGEventRef move2 = CGEventCreateMouseEvent( NULL, kCGEventMouseMoved, … Read more

Detecting a long press in Android

GestureDetector is the best solution. Here is an interesting alternative. In onTouchEvent on every ACTION_DOWN schedule a Runnable to run in 1 second. On every ACTION_UP or ACTION_MOVE, cancel scheduled Runnable. If cancelation happens less than 1s from ACTION_DOWN event, Runnable won’t run. final Handler handler = new Handler(); Runnable mLongPressed = new Runnable() { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)