android Programming Glossary: ontouchevent
How did Google manage to do this? Slide ActionBar in Android application http://stackoverflow.com/questions/11234375/how-did-google-manage-to-do-this-slide-actionbar-in-android-application context attrs this.enabled true @Override public boolean onTouchEvent MotionEvent event if this.enabled return super.onTouchEvent.. MotionEvent event if this.enabled return super.onTouchEvent event return false @Override public boolean onInterceptTouchEvent.. context attrs this.enabled true @Override public boolean onTouchEvent MotionEvent event if this.enabled return super.onTouchEvent..
Scrollview vertical and horizontal in android http://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android Context context super context @Override public boolean onTouchEvent MotionEvent ev return false Custom HorizontalScrollView package.. Context context super context @Override public boolean onTouchEvent MotionEvent ev return false the ScrollableImageActivity package.. findViewById R.id.hScroll @Override public boolean onTouchEvent MotionEvent event float curX curY switch event.getAction case..
how to hide soft keyboard on android after clicking outside EditText? http://stackoverflow.com/questions/4165414/how-to-hide-soft-keyboard-on-android-after-clicking-outside-edittext is not an EditBox or the softKeyboard I tried to use the onTouchEvent on my parent Activity but that only works if user touches outside..
creating a system overlay (always on top) button in android http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android can receive touch events on itself. I tried overriding onTouchEvent for the whole ViewGroup but it does not receive any event. How.. arg1 int arg2 int arg3 int arg4 @Override public boolean onTouchEvent MotionEvent event return super.onTouchEvent event Toast.makeText.. public boolean onTouchEvent MotionEvent event return super.onTouchEvent event Toast.makeText getContext onTouchEvent Toast.LENGTH_LONG..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android operates a little quirky. Here is my slightly adapted onTouchEvent from that example public boolean onTouchEvent MotionEvent event.. adapted onTouchEvent from that example public boolean onTouchEvent MotionEvent event xPos event.getX yPos event.getY oOffset.. getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent event if isEnabled return false switch event.getAction..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas TOUCH @Override public synchronized boolean onTouchEvent MotionEvent ev switch ev.getAction case MotionEvent.ACTION_DOWN..
How I can get onclick event on webview in android? http://stackoverflow.com/questions/5116909/how-i-can-get-onclick-event-on-webview-in-android touch events to an OnTouchListener . It does have its own onTouchEvent method but I only ever seemed to get MotionEvent.ACTION_MOVE..
enable/disable zoom in Android WebView http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview if getPointerCount ev 1 return true this code is in my onTouchEvent overriden method of the WebView android webview zoom multi..
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch BlurMaskFilter 15 Blur.NORMAL @Override public boolean onTouchEvent MotionEvent ev switch ev.getAction case MotionEvent.ACTION_DOWN..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events context new ScaleListener @Override public boolean onTouchEvent MotionEvent ev Let the ScaleGestureDetector inspect all events... ScaleGestureDetector inspect all events. mScaleDetector.onTouchEvent ev final int action ev.getAction switch action MotionEvent.ACTION_MASK..
Android : how to capture a image of GPS location http://stackoverflow.com/questions/9905250/android-how-to-capture-a-image-of-gps-location screenPts.y 50 null return true public boolean onTouchEvent MotionEvent event MapView mapView when user lifts his finger..
How to detect doubletap on a View? [duplicate] http://stackoverflow.com/questions/2640119/how-to-detect-doubletap-on-a-view boolean onTouchEvent MotionEvent event Log.v DEBUG_TAG OnTouchEvent boolean result gestureScanner.onTouchEvent event return the..
Getting coordinates when clicking anywhere on a MapView http://stackoverflow.com/questions/2787204/getting-coordinates-when-clicking-anywhere-on-a-mapview the MapActivity inherits the dispatchTouch Event not OnTouchEvent from Activity Class. check this documentation @Override public..
android: MapView does not recognize clicks http://stackoverflow.com/questions/4513766/android-mapview-does-not-recognize-clicks question Add an Overlay in your map view and handle the OnTouchEvent. Try something like this public class MyMapActivity extends..
How do I respond to a tap on an Android MapView, but ignore pinch-zoom? http://stackoverflow.com/questions/4806061/how-do-i-respond-to-a-tap-on-an-android-mapview-but-ignore-pinch-zoom ignoring pinch zoom and double taps Do I need to use OnTouchEvent instead of OnTap If so how do I distinguish between the different..
enable/disable zoom in Android WebView http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview I ended up doing was subclassing WebView and overriding OnTouchEvent . In OnTouchEvent for ACTION_DOWN I check how many pointers.. was subclassing WebView and overriding OnTouchEvent . In OnTouchEvent for ACTION_DOWN I check how many pointers there are using MotionEvent.getPointerCount.. I call setSupportZoom false . I then call the super.OnTouchEvent . This will effectively disable zooming when scrolling thus..
Android How to register OnTouchEvent for entire Activity main content view? http://stackoverflow.com/questions/5279182/android-how-to-register-ontouchevent-for-entire-activity-main-content-view How to register OnTouchEvent for entire Activity main content view I have implemented onTouchEvent..
Concurrent Modification Exception : adding to an ArrayList http://stackoverflow.com/questions/6866238/concurrent-modification-exception-adding-to-an-arraylist And this code which contains that line is inside of an OnTouchEvent for Iterator Element it mElements.iterator it.hasNext Element..
How did Google manage to do this? Slide ActionBar in Android application http://stackoverflow.com/questions/11234375/how-did-google-manage-to-do-this-slide-actionbar-in-android-application ExtendedViewPager Context context AttributeSet attrs super context attrs this.enabled true @Override public boolean onTouchEvent MotionEvent event if this.enabled return super.onTouchEvent event return false @Override public boolean onInterceptTouchEvent.. context attrs this.enabled true @Override public boolean onTouchEvent MotionEvent event if this.enabled return super.onTouchEvent event return false @Override public boolean onInterceptTouchEvent MotionEvent event if this.enabled return super.onInterceptTouchEvent.. Context context AttributeSet attrs super context attrs this.enabled true @Override public boolean onTouchEvent MotionEvent event if this.enabled return super.onTouchEvent event return false @Override public boolean onInterceptTouchEvent..
Scrollview vertical and horizontal in android http://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android context AttributeSet attrs super context attrs public VScroll Context context super context @Override public boolean onTouchEvent MotionEvent ev return false Custom HorizontalScrollView package com.scrollable.view import android.content.Context import.. context AttributeSet attrs super context attrs public HScroll Context context super context @Override public boolean onTouchEvent MotionEvent ev return false the ScrollableImageActivity package com.scrollable.view import android.app.Activity import.. ScrollView findViewById R.id.vScroll hScroll HorizontalScrollView findViewById R.id.hScroll @Override public boolean onTouchEvent MotionEvent event float curX curY switch event.getAction case MotionEvent.ACTION_DOWN mx event.getX my event.getY break..
how to hide soft keyboard on android after clicking outside EditText? http://stackoverflow.com/questions/4165414/how-to-hide-soft-keyboard-on-android-after-clicking-outside-edittext when the user touches or selects any other place that is not an EditBox or the softKeyboard I tried to use the onTouchEvent on my parent Activity but that only works if user touches outside any other view and there is no scrollview. I tried to..
creating a system overlay (always on top) button in android http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android to add a button clickable image in place of this text which can receive touch events on itself. I tried overriding onTouchEvent for the whole ViewGroup but it does not receive any event. How can I receive events only on certain parts of my always on.. mLoadPaint @Override protected void onLayout boolean arg0 int arg1 int arg2 int arg3 int arg4 @Override public boolean onTouchEvent MotionEvent event return super.onTouchEvent event Toast.makeText getContext onTouchEvent Toast.LENGTH_LONG .show return.. boolean arg0 int arg1 int arg2 int arg3 int arg4 @Override public boolean onTouchEvent MotionEvent event return super.onTouchEvent event Toast.makeText getContext onTouchEvent Toast.LENGTH_LONG .show return true android overlay android ui share improve..
How can I get a working vertical SeekBar in Android? http://stackoverflow.com/questions/4892179/how-can-i-get-a-working-vertical-seekbar-in-android pointed to VerticalSeekBar post here . As it is the SeekBar operates a little quirky. Here is my slightly adapted onTouchEvent from that example public boolean onTouchEvent MotionEvent event xPos event.getX yPos event.getY oOffset this.getThumbOffset.. it is the SeekBar operates a little quirky. Here is my slightly adapted onTouchEvent from that example public boolean onTouchEvent MotionEvent event xPos event.getX yPos event.getY oOffset this.getThumbOffset oProgress this.getProgress Code from.. protected void onDraw Canvas c c.rotate 90 c.translate getHeight 0 super.onDraw c @Override public boolean onTouchEvent MotionEvent event if isEnabled return false switch event.getAction case MotionEvent.ACTION_DOWN case MotionEvent.ACTION_MOVE..
How can I use the animation framework inside the canvas? http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas of the screen. ballY 50 Centre ball height above the screen. TOUCH @Override public synchronized boolean onTouchEvent MotionEvent ev switch ev.getAction case MotionEvent.ACTION_DOWN ballX int ev.getX ballW 2 ballY int ev.getY ballH 2 ..
How I can get onclick event on webview in android? http://stackoverflow.com/questions/5116909/how-i-can-get-onclick-event-on-webview-in-android to hear it. What I did find is that a WebView will send touch events to an OnTouchListener . It does have its own onTouchEvent method but I only ever seemed to get MotionEvent.ACTION_MOVE using that method. So given that we can get events on a registered..
enable/disable zoom in Android WebView http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview .setSupportZoom false if multiTouchZoom buttonsZoom if getPointerCount ev 1 return true this code is in my onTouchEvent overriden method of the WebView android webview zoom multi touch share improve this question I've looked at the source..
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch pTouch.setColor Color.TRANSPARENT pTouch.setMaskFilter new BlurMaskFilter 15 Blur.NORMAL @Override public boolean onTouchEvent MotionEvent ev switch ev.getAction case MotionEvent.ACTION_DOWN X int ev.getX Y int ev.getY invalidate break case..
Image in Canvas with touch events http://stackoverflow.com/questions/5743328/image-in-canvas-with-touch-events context attrs defStyle mScaleDetector new ScaleGestureDetector context new ScaleListener @Override public boolean onTouchEvent MotionEvent ev Let the ScaleGestureDetector inspect all events. mScaleDetector.onTouchEvent ev final int action ev.getAction.. @Override public boolean onTouchEvent MotionEvent ev Let the ScaleGestureDetector inspect all events. mScaleDetector.onTouchEvent ev final int action ev.getAction switch action MotionEvent.ACTION_MASK case MotionEvent.ACTION_DOWN final float x ev.getX..
Android : how to capture a image of GPS location http://stackoverflow.com/questions/9905250/android-how-to-capture-a-image-of-gps-location getResources R.drawable.pin canvas.drawBitmap bmp screenPts.x screenPts.y 50 null return true public boolean onTouchEvent MotionEvent event MapView mapView when user lifts his finger if event.getAction 1 GeoPoint p mapView.getProjection .fromPixels..
How to detect doubletap on a View? [duplicate] http://stackoverflow.com/questions/2640119/how-to-detect-doubletap-on-a-view method of the GestureDetector object. @Override public boolean onTouchEvent MotionEvent event Log.v DEBUG_TAG OnTouchEvent boolean result gestureScanner.onTouchEvent event return the double tap events return result share improve this answer..
Getting coordinates when clicking anywhere on a MapView http://stackoverflow.com/questions/2787204/getting-coordinates-when-clicking-anywhere-on-a-mapview question use dispatchTouchEvent method. it works. why because the MapActivity inherits the dispatchTouch Event not OnTouchEvent from Activity Class. check this documentation @Override public boolean dispatchTouchEvent MotionEvent ev int actionType..
android: MapView does not recognize clicks http://stackoverflow.com/questions/4513766/android-mapview-does-not-recognize-clicks android android mapview mapactivity share improve this question Add an Overlay in your map view and handle the OnTouchEvent. Try something like this public class MyMapActivity extends MapActivity class MapOverlay extends com.google.android.maps.Overlay..
How do I respond to a tap on an Android MapView, but ignore pinch-zoom? http://stackoverflow.com/questions/4806061/how-do-i-respond-to-a-tap-on-an-android-mapview-but-ignore-pinch-zoom to taps on a MapView and only pick up single taps specifically ignoring pinch zoom and double taps Do I need to use OnTouchEvent instead of OnTap If so how do I distinguish between the different touch events and how do I access the GeoPoint Here's the..
enable/disable zoom in Android WebView http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview is no elegant way to accomplish what you are asking. What I ended up doing was subclassing WebView and overriding OnTouchEvent . In OnTouchEvent for ACTION_DOWN I check how many pointers there are using MotionEvent.getPointerCount . If there is more.. way to accomplish what you are asking. What I ended up doing was subclassing WebView and overriding OnTouchEvent . In OnTouchEvent for ACTION_DOWN I check how many pointers there are using MotionEvent.getPointerCount . If there is more than one pointer.. is more than one pointer I call setSupportZoom true otherwise I call setSupportZoom false . I then call the super.OnTouchEvent . This will effectively disable zooming when scrolling thus disabling the zoom controls and enable zooming when the user..
Android How to register OnTouchEvent for entire Activity main content view? http://stackoverflow.com/questions/5279182/android-how-to-register-ontouchevent-for-entire-activity-main-content-view How to register OnTouchEvent for entire Activity main content view I have implemented onTouchEvent TouchEvent on my activity. However I would like to..
Concurrent Modification Exception : adding to an ArrayList http://stackoverflow.com/questions/6866238/concurrent-modification-exception-adding-to-an-arraylist to an ArrayList The problem occurs at Element element it.next And this code which contains that line is inside of an OnTouchEvent for Iterator Element it mElements.iterator it.hasNext Element element it.next if touchX element.mX touchX element.mX element.mBitmap.getWidth..
|