Note that there are some explanatory texts on larger screens.

plurals
  1. POtouchend event doesn't work on Android
    primarykey
    data
    text
    <p>I've just started looking at doing some basic mobile web development on the android and an writing a test script to investigate the touch events. I've run the following code in the android emulator, and the touchend event never gets fired. Can anyone tell me why ? </p> <p>I've tried in three versions of the emulator (1.6, 2.1 and 2.2) and all three behave in the same way.</p> <p>Thanks in advance for any help you can give me.</p> <p>Cheers, Colm</p> <p>EDIT - I've also tried this using the XUI framework and have the same problem so I'm guessing I have a fundamental misunderstanding of how this stuff works ......</p> <p> Map Test </p> <pre><code> &lt;meta name="description" content="" /&gt; &lt;meta name="keywords" content="" /&gt; &lt;meta name="language" content="english" /&gt; &lt;meta name="viewport" content="minimum-scale=1.0, width=device-width, height=device-height, user-scalable=no"&gt; &lt;script type="text/javascript"&gt; window.onload = function(){ document.body.appendChild( document.createTextNode("w: " + screen.width + " x " + "h : " +screen.height) ); attachTouchEvents(); } function attachTouchEvents() { console = document.getElementById("console"); var map = document.getElementById("map"); map.addEventListener ('touchstart', function (event) { event.preventDefault(); var touch = event.touches[0]; document.getElementById("touchCoord").innerHTML = "S : " + touch.pageX + " " + touch.pageY; document.getElementById("touchEvent").innerHTML = "Touch Start"; }, false); map.addEventListener ('touchmove', function (event) { event.preventDefault(); var touch = event.touches[0]; document.getElementById("touchCoord").innerHTML = "M : " + touch.pageX + " " + touch.pageY; document.getElementById("touchEvent").innerHTML = "Touch Move"; }, false); map.addEventListener ('touchend', function (event) { var touch = event.touches[0]; document.getElementById("touchCoord").innerHTML = "E : " + touch.pageX + " " + touch.pageY; document.getElementById("touchEvent").innerHTML = "Touch End"; event.preventDefault(); }, false); console.innerHTML = "event attached"; } &lt;/script&gt; &lt;style type="text/css"&gt; html, body { height:100%; width:100%; margin: 0; background-color:red; } #map { height: 300px; width: 300px; background-color:yellow; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="map"&gt;&lt;/div&gt; &lt;div id="touchCoord"&gt;Touch Coords&lt;/div&gt; &lt;div id="touchEvent"&gt;Touch Evnt&lt;/div&gt; &lt;div id="console"&gt;Console&lt;/div&gt; &lt;/body&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload