touch-event

What is the difference between the click and tap events?

六眼飞鱼酱① 提交于 2019-11-28 04:30:01
I am developing an app that runs on Android/iOS and desktop computers. Should I use the click or the tap event? What are the differences between them? Will the 'tap' work on desktop? if not, (and I have to use click ) am I missing any advantages that the tap has over the click ? Touch events and mouse events are entirely different beasts. They are not interchangeable. That said, I'm using jQuery Touch Punch which maps touch events to their mouse event analogs, so a tap becomes the same thing as a click. This makes it possibly to use all the standard jQuery UI goodness without having to do any

onTouch, onLongClick together in android

徘徊边缘 提交于 2019-11-28 03:35:38
问题 I'am adding imageviews to parent layout dynamically. And i'am performing zoom in/out operations onTouch of added image. I want to remove the added view onLongPress of it. img.setOnLongClickListener(longClickAction); img.setOnTouchListener(touchAction); onLongPress : OnLongClickListener longClickAction = new OnLongClickListener() { @Override public boolean onLongClick(View v) { parentLayout.removeView((ImageView)v); return false; } }; onTouch : OnTouchListener touchAction = new OnTouchListener

iOS - Can an app running in the background send touch / gesture events to another app in the foreground?

ⅰ亾dé卋堺 提交于 2019-11-28 02:12:52
问题 I have been asked to develop an app that will record and later "play back" touches and gestures onto another app running in the foreground. From my experience and knowledge, this is not possible unless both apps are setup to send/receive data between them through notifications or other methods. Also, it would be a huge risk for apps and their data to be exposed to anybody. I am 99% sure this is not possible, but was just curious if anyone else has come across something similar (or

In onTouchEvent, ACTION_UP doesn't work

泄露秘密 提交于 2019-11-27 23:34:34
问题 I'd like to read when a player touches the screen, and when not. @Override public boolean onTouchEvent(MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_UP){ //ACTION UP actionOnUP = true; Log.v("MC", "Up"); } if(event.getAction() == 0){ //ACTION DOWN actionOnUP = false; Log.v("MC", "Down"); } Log.v("MC", event.getAction() + " "); return super.onTouchEvent(event); } This code, yes, it works, but only when player touch the screen (ACTION_DOWN), but when he don't touching the

How to vary between child and parent view group touch events

余生颓废 提交于 2019-11-27 22:52:49
I decided to post this question and answer in response to this comment to this question: How to handle click in the child Views, and touch in the parent ViewGroups? I will paste the comment here: Suppose I want to override the touch events only for handling some of the children, what can I do inside this function to have it working ? I mean, for some children it would work as usual, and for some, the parent-view will decide if they will get the touch events or not. So the question is this: How do I prevent the parent onTouchEvent() from overriding some child elements' onTouchEvent() , while

how to swipe a button onTouch event in android

巧了我就是萌 提交于 2019-11-27 22:39:35
问题 How to swipe a button on touch event android with directions left,right, up,down..?...I am new to android and want to develop a callback application.Please help by providing some links callbackButton.setOnTouchListener(new OnTouchListener() { private float currX; private float currY; @Override public boolean onTouch(View v, MotionEvent event) { float x1 = 0, x2, y1 = 0, y2, dx, dy , oldx =0,oldy=0; String direction; switch(event.getAction()) { case MotionEvent.ACTION_DOWN: oldx = event.getX()

How to add a gesture detector to a view in Android

蹲街弑〆低调 提交于 2019-11-27 22:07:35
I was struggling with adding a gesture detector to a subview in my project. Do I override the parent's onTouchEvent or the child's onTouchEvent ? Do I make an OnTouchListener and add the gesture detector there? The documentation shows an example for how to add a gesture detector to the activity itself but it is not clear how to add it to a view. The same process could be used if subclassing a view (example here ), but I want to add the gesture without subclassing anything. This is the closest other question I could find but it is specific to a fling gesture on an ImageView , not to the general

Add Marker on Android Google Map via touch or tap

断了今生、忘了曾经 提交于 2019-11-27 19:24:46
I am a beginner in Android Developer. I want to develop a Map Application using Google Map. Now, I want to add marker on the map via Touch or Tap on the Map. I do not know how to apply touch event to drop the marker on the map. Please tell me and, if it is possible, please give me some links or examples. Thank you and sorry for my English. user3066085 This code is Successful run I am working on that code this code is for Dynamic Draw I think this code help you more for Static or dynamic both places you can use this code double latval = Double.parseDouble(jsonobject.getString("lat")); double

onTouchevent() vs onTouch()

依然范特西╮ 提交于 2019-11-27 17:56:53
After many experiments with onTouchEvent and onTouch, I found that onTouch works everywhere you want (whether it is in activity or view) as long as you have declared the interface and put the Listener right! On the other hand, onTouchEvent only works inside a View! Is my assumption correct? Is this the real difference? Yes you are correct - onTouch() is used by users of the View to get touch events while onTouchEvent() is used by derived classes of the View to get touch events. Dexter I had some confusion related to how onTouchEvent() and onTouch() work (You can see my comment to this question

Moving an Image in circular motion based on touch events in android

杀马特。学长 韩版系。学妹 提交于 2019-11-27 17:03:28
问题 I am trying to move an ImageView (not rotate). The movement is supposed to be on the edge of a circle. This circle is also an image view. based on the onTouch, ACTION_MOVE event, I am trying to move it. Noe the Dilema is that the use may not move the finger in a perfectly circular fashion but I would like to make sure that the image still moves around edge of this circle. I am currently using the following inside ACTION_MOVE: mCurrTempIndicator.setTranslationX(event.getX());