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

Method onTouchEvent not being called

I found a perfect solution. I implemented new method: @Override public boolean dispatchTouchEvent(MotionEvent event) { View v = getCurrentFocus(); boolean ret = super.dispatchTouchEvent(event); and now it all works fine! Edit: My final code: @Override public boolean dispatchTouchEvent(MotionEvent event) { View v = getCurrentFocus(); if (v instanceof EditText) { View w = getCurrentFocus(); int scrcoords[] = … Read more

checking if touchend comes after a drag

Use two listeners: First set a variable to false: var dragging = false; Then ontouchmove set dragging to true $(“body”).on(“touchmove”, function(){ dragging = true; }); Then on drag complete, check to see if dragging is true, and if so count it as a dragged touch: $(“body”).on(“touchend”, function(){ if (dragging) return; // wasn’t a drag, just … Read more