touch-event

How to detect html elements on touchmove

送分小仙女□ 提交于 2019-12-13 07:14:46
问题 I've a series of list items. On an iphone (touch device), as a user touches and moves his finger across the screen, I want to capture all the html li elements that he has touched. So how do I get that? Say I want to get all the ids of those elements and alert is when the touch ends. I tried with jQuery Mobile with "swipe' event but only the first one to be touched, that too if the 'touch' starts from that particular element shows up. 回答1: Not sure if this will work on a mobile device unless

Passing x,y coordinates of drawCircle() to drawLine()

瘦欲@ 提交于 2019-12-13 05:47:46
问题 I am trying to draw line between two circles. I have drawn two circles on canvas, These two circles have their cx and cy points. I want to pass these cx and cy of both circles to drawLine()'s startx,starty and stopx,stopy. So that a line should be drawn between these two circles. These two circles can be parallel to each other or horizontal to each other. What I have planned so far is that I should apply action-listener to circles in order to get their x and y coordinates. The problem I am

Android touchevent— need help/suggestion according to scenario

女生的网名这么多〃 提交于 2019-12-13 04:58:33
问题 Now I have an ImageView and its a circle which is at the slightly below than center position (But this should not matter). I have written code onTouch of ImageView for ACTION_DOWN,ACTION_UP ,now consider as user have put finger on circle and move and move.... I want to active some code when user move finger and exceed the region of CIRCLE image(As soon as user exceed the region the code should be ececuted onlly once) Here is my code ImageView view1 = (ImageView) findViewById(R.id

OnTouchListener not working inside Activity

梦想的初衷 提交于 2019-12-13 04:47:06
问题 so I had some problems with the onTouch method, it didnt do anything, at first i thought something wrogn with the code but then i did this, and it still doesnt work when i touch the screen. Anyone knows what is the problem? Thnx. { private FartPianoView fpv; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); fpv = new FartPianoView(this); setContentView(fpv); }

UIWebView and touch event

与世无争的帅哥 提交于 2019-12-13 04:13:09
问题 I want use a custom touch event in a view. There is a web view which is the subview of this view. I override touchBegan and other functions but it does not run. 回答1: If you want to call a function while tapping a view you can use UITapGestureRecognizer override func viewDidLoad() { super.viewDidLoad() let tapRecognizer = UITapGestureRecognizer(target: view, action: "handleSingleTap:") tapRecognizer.numberOfTapsRequired = 1 self.view.addGestureRecognizer(tapRecognizer) } func handleSingleTap

Why would onTouch() generate FATAL EXCEPTION when returning false?

霸气de小男生 提交于 2019-12-13 02:37:23
问题 I wrote a simple MotionEvent exercise in which all I do is log the parameters of the event. I do that by implementing OnTouchListener and overriding onTouch() in the main activity. For one button, I return true at the end of onTouch(). No problems there. For another button, I return false at the end of onTouch(). This is where it gets interesting. By mere returning 'false', a FATAL EXCEPTION is thrown with a tiny hint which I don't really understand: "recycled twice!". What does this mean?

android:onClick listener for just onTouch in XML

吃可爱长大的小学妹 提交于 2019-12-13 01:09:56
问题 I want to use the xml code android:onClick="OnClickMethod" . However, this means that the method will only be called onClick (i.e. in reality the user has to click the editText twice) instead of onTouch. Is there an equivalent way that I can call the " OnClickMethod " on a user touch, instead of user click via XML? 回答1: try to use onTouchEvent instead of onClick This is a good site for performing double click. http://mobile.tutsplus.com/tutorials/android/android-gesture/ [EDIT 1] @Override

Touch Event Blackberry Triggered Multiple Times

不羁岁月 提交于 2019-12-13 00:36:56
问题 I'm working with the Blackberry Touch Event and I need to process the TouchEvent.MOVE , TouchEvent.UP and TouchEvent.DOWN to move a carousel of images and the TouchEvent.CLICK to generate some specific action. My problem is that the touchEvent() method is being called several times. How can I prevent this? Because the behaviour is getting all messed up. For example: when I just want to capture the TouchEvent.CLICK event, the UP-DOWN-MOVE-CLICK are being triggered one after the next. My code

Weird behavior of long presses in Chrome and Firefox for Android

我怕爱的太早我们不能终老 提交于 2019-12-13 00:18:10
问题 So, I found some weird behavior of long presses in Chrome and Firefox for Android. I'm trying to avoid scrolling, context menus, vibration and selecting text. Also, I need the touch not to be canceled. I set a simple page like this: var logger = document.getElementById("logger") function touchHandler(e) { e.preventDefault() logger.innerText += e.type + "\n" } function contextMenuHandler(e) { e.preventDefault() logger.innerText += e.type + "\n" } window.addEventListener("touchstart",

Android: How to make onTouch work like onClick?

不羁岁月 提交于 2019-12-12 18:04:14
问题 I used this tutorial http://mobiforge.com/developing/story/using-google-maps-android to display Map view and set onTouch event to display a toast message (latitude/longitude) when I click on a particular area. Now my problem is that the Toast message is displayed the moment I touch the screen even if it is to move the map? I want to display the toast only if the touch down point and touch up point are the same. How do I implement that? 回答1: Check if the move bit is set in the MotionEvent if