We've found that in testing our iPhone app on Android on the device, if we touch a button or row label (table view) longer than a very quick tap, the "click" event handler does not trigger. We are checking the logs by running adb -d logcat, and nothing happens.
This also happens in Kitchen Sink on Android under the Controls / Button screen - press the Click Me button for more that 0.2 seconds, and it will do nothing.
This happens on ANY button or table view row that has a click event. The buttons all have images behind them, with alternative images for the button-down view, and those register as you hold the button down. (This is all the same code that was compiled and runs fine on the iPhone.)
Is there something we're missing, or a parameter that we can adjust for finger taps? And no, we are not "sliding" our finger when we "slow tap" a button (and by slow, I mean a casual, cautious tap to ensure you are hitting a particular spot on the screen, for example).
Surely if you leave your finger on the screen for more than a pre-defined length of time, the action becomes a touch? Check out the
touchend events of most UI controls.
If you have observed that the same code runs differently on android and iOS platforms, then your concerns may indeed be valid.
Would you create a use-case, as per the Creating Good Use-cases documentation, and give us an example in one of the default android apps (installed by default on the emulator) that demonstrates the proper behavior, for comparison?
For a Use-case that works on Android Sim, try the Settings app. On the opening screen, click Display, then Brightness. Click and hold the mouse down on OK or Cancel as long as you want, then let go; the event triggers the exact same way if you had just tapped it. AND, all our Ti iOS apps' buttons and table views work this way (including this one we are trying to convert to Android).
Now try the same thing in the Kitchen Sink on the Sim. On the Controls menu, try the Button menu item. Click and hold the green Click Me button for 1/2 second, even 1/4 second, and let go - pause just briefly before letting go. You get no action. Now just click and let go - the button changes, as it is supposed to. Same with the Base UI / View / Alert Dialog screen buttons.
Load KS on your Android device and try the buttons on any screen - they all behave the same way - no action with the slightest pause on the button. Try any non-TI app with a button - pressing and holding the button for any time makes no difference - it's always a click.
BTW, I am getting the same behavior on a Table View with a label and one or two buttons in each row. No click event is triggered on the row with the slightest pause.
This currently broken in 1.5.x.
I spend some hours to track this down yesterday.
The intended behavior if I interpret the code correctly is that you can touch inside an element and as long as you do not move your finger out of the elements area a touch end event will be fired if you lift your finger.
Due to some wrong code handling the action described above will always result in a touch_cancel event (unless the element is located in the top left corner).
I created a patch to fix this issue and opened up a ticket:
the fork is based on 1.5.1 and also addresses some other issues in 1.5.1. Additionally it provides basic support for longpress events on table views so you will be able to have longpress option dialog boxes as in other native android apps.
To let you know, there is a ticket now for this issue at #2844
Ticket 2844 exists to track the problem. A fix is not going into 1.6.0. If you're in a hurry a community member provided a patch in this thread that you can apply to get your own build with the fix.
Think you can help? Login to answer this question!