touch-event

Android - wait for touch event

女生的网名这么多〃 提交于 2019-12-12 14:21:24
问题 In my Android app, I'd like to display several images on the screen in sequence, waiting for a touch event (a single tap) to go to the next one. I saw here that one way to do this should be: public class LoadImage extends Activity { private Thread thread; //defined inside the activity @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_load_image); [get an image and create a bitmap from it] ImageView imageView =

ViewPager swipe with 2 fingers

删除回忆录丶 提交于 2019-12-12 13:16:20
问题 I would to implement a ViewPager swipe with two fingers. I tried to implement a sublcass of ViewPager overriding the onTouchEvent and passing the method to superclass only if the touch is made by 2 fingers. But there is a problem: the swipe animation also works with 1 finger! I think I have to override some other method... This is my ViewPager class: public class MyViewPager extends ViewPager{ public MyViewPager(Context context) { super(context); } public MyViewPager(Context context

Check which direction was flinged in a Motion event android

泪湿孤枕 提交于 2019-12-12 09:53:37
问题 So i want to detect which direction the user moved his finger when touching the screen Right now its working for 3 directions but the "up" movement does not get called. This is my code: @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { // store the X value when the user's finger was pressed down downXValue = event.getX(); downYValue = event.getY(); break; } case MotionEvent.ACTION_UP: { // Get the X value when the user

Multitouch touchEvents not triggered as they should on Safari Mobile

隐身守侯 提交于 2019-12-12 09:06:53
问题 I have various touchEvents detection on a page on Safari Mobile (a controller, if you want to know...). They all work well indepedantly, but whenever I have a first touchpoint pressed, If I touch a new point, the events are triggered when I trigger a new one. For example : I hold the stick with a finger. It's not moving I press a button, a touchStart event should be triggered but is not If I move the stick, the touchStart event is triggered If I let go of the button, the touchStart is

MyGestureDetector extends SimpleOnGestureListener

大城市里の小女人 提交于 2019-12-12 07:58:45
问题 I am implementing a MyGestureDetector that extends a SimpleOnGestureListener. I borrowed the class from: http://www.codeshogun.com/blog/tag/view-flipper/ to allow a swipe action in a ViewFlipper. I can not get if to function on the emulator. Any suggestions? Below is all of the code: The main.java import android.app.Activity; import android.os.Bundle; import android.view.GestureDetector; import android.view.KeyEvent; import android.view.MotionEvent;import android.view.View; import android

HowTo OnTouch on a paint overlay (googlemaps)?

泄露秘密 提交于 2019-12-12 05:09:22
问题 I paint a overlay on my googlemaps view (closed polygon, filled). But now I don't know how to pop up a toast when I tap on the overlay. The most examples wich I found work with marker and looks verry different to my code. Main Activity: public class BOSLstItemDetail extends MapActivity{ ArrayList<HashMap<String, Object>> boslst; MapView mapView; MapController mapcontrol; GeoPoint p; Polygon polygon; @Override protected boolean isRouteDisplayed() { return false; } @Override public void

Play A Random Sound onTouch

瘦欲@ 提交于 2019-12-12 04:58:24
问题 I'm trying to play a random sound onTouch event (currently working), but the sound is actually played twice onTouch event instead of once as intended. I'm assuming this is due to the UP and Down onTouch event. Any thoughts? NOTE: I commented out the additional random sound files while testing. package com.tmapps.wiub; import java.util.Random; import com.tmapps.wiub.SoundManager; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.Window;

fighting touch events on mobile devices, highjacking normal scroll

烂漫一生 提交于 2019-12-12 04:36:45
问题 I went through the code several times and I cannot find the reason it fails on touch based devices: /** * Initialize touch event listener. * * @returns {Plugin} */ touch: function () { var self = this; this._$body.bind('touchstart', function (event) { var startEvent = event.originalEvent.touches[0]; event.preventDefault(); self._$body.bind('touchmove', function (event) { var moveEvent = event.originalEvent.touches[0]; var diff = { x: startEvent.clientX - moveEvent.clientX, y: startEvent

requestDisallowInterceptTouchEvent for Scrollview

心已入冬 提交于 2019-12-12 03:23:50
问题 I have a StreetViewPanoramaView inside a linearlayout inside a scrollview: <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scrollview"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/linear"> <com.google.android.gms.maps.StreetViewPanoramaView android:id="@+id/street_view_panorama" android:layout_width="match_parent" android:layout_height="wrap_content"

View pager onInterceptTouchEvent not generating event

浪子不回头ぞ 提交于 2019-12-12 03:23:00
问题 I have written an custom ViewPager but it's not generating event for Continuous Action.Move. On touch it generate DOWN once and MOVE event 2-3 time and that's it. Then after it not generate MOVE event. Parent XML code. <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <example.animation.com.CustomPager android:id="@+id/pager" android:background="#123456"