How to vary between child and parent view group touch events

The onTouchEvents() for nested view groups can be managed by the boolean onInterceptTouchEvent. The default value for the OnInterceptTouchEvent is false. The parent’s onTouchEvent is received before the child’s. If the OnInterceptTouchEvent returns false, it sends the motion event down the chain to the child’s OnTouchEvent handler. If it returns true the parent’s will handle … Read more

Add Marker on Android Google Map via touch or tap

Try using new Google Map API v2. It’s easy to use and you can add a marker on tap like this: map.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng point) { allPoints.add(point); map.clear(); map.addMarker(new MarkerOptions().position(point)); } }); or in Kotlin: map.setOnMapClickListener { allPoints.add(it) map.clear() map.addMarker(MarkerOptions().position(it)) } Note that you might want to remember all your added … Read more

Android – Detect End of Long Press

I think your best bet is to use a combination of the onLongClickListener() and onTouchListener() for that button. You’ll need to catch certain events on the touch listener since it will trigger for every touch event. Try something like the following: class Blah extends Activity { private Button mSpeak; private boolean isSpeakButtonLongPressed = false; @Override … Read more