Working Android Studio Tap Hold Location Add Marker App Able Edit Title Q37037567

When working with android studio, how can you tap and hold on alocation to add a marker to the app with being able to edit thetitle of it?


Solution


What you essentially want to do is to be able to get the x,ycoordinates of tap and hold location. And then add some floating UIelements at that location.

You may want to look at View.OnLongClickListener to be able toget x,y coordinates of the touch location.

————-Code Snipped forListener—————

private View.OnTouchListener handleTouch = newView.OnTouchListener() {
   @Override
   public boolean onTouch(View v, MotionEvent event){
       int x = (int) event.getX();
       int y = (int) event.getY();

      

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.