Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:13:51+00:00 2026-05-17T23:13:51+00:00

I have a mapview and i wish to display a ContextMenu when longclick but

  • 0

I have a mapview and i wish to display a ContextMenu when longclick but so far the closest solution i’ve found is here on anddev , the main reason i do not like that method is because any click activate the ContextMenu instead of a long click.

Question:

Is there a way to display the ContextMenu of a Map without using Overlays? Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:13:51+00:00Added an answer on May 17, 2026 at 11:13 pm

    This is the approach I used. I created an AbstractMap class which extended MapActivity. From here I then extended from the AbstractMap class to create a Map which suited my requirements. Note I only used this approach since I was requiring several maps with varying properties for my application. You could simply remove the Abstract keyword from the AbstractMap, directly override the OnGestureListener methods within this class and instantiate it.

    Here is the AbstractMap class

    public abstract class AbstractMap extends MapActivity implements OnGestureListener, OnDoubleTapListener {
    
    public MapView mapView;
    public MapController mapController;
    public List<Overlay> mapOverlays;
    private GestureDetector detector;
    
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        try {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.mapp);
            detector = new GestureDetector(this, this);
            mapView = (MapView) findViewById(R.id.mapview);
            mapView.setOnTouchListener(otl);
            mapController = mapView.getController();
            mapOverlays = mapView.getOverlays();
        } catch (Exception e) {
            Log.e("Error", "Exception", e);
        }
    }
    
    public OnTouchListener otl = new OnTouchListener() {
    
        @Override
        public boolean onTouch(View v, MotionEvent event) {
    
            if (detector.onTouchEvent(event))
                return true;
            else
                return false;
    
        }
    };
    

    }

    Here is the LongPressMap

    public class LongPressMap extends AbstractMap {
    
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
    }
    
    
    
    @Override
    public boolean onDown(MotionEvent event) {  
    
        return false;
    }
    
    
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {
    
    
        return false;
    }
    
    
    @Override
    public void onLongPress(MotionEvent e) {        
    
    }
    
    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
            float distanceY) {
        //Log.d("Debug","On Scrtoll");
        // TODO Auto-generated method stub
        return false;
    }
    
    @Override
    public void onShowPress(MotionEvent e) {
    
    
    }
    
    @Override
    public boolean onSingleTapUp(MotionEvent e) {
    
        return false;
    }
    
    @Override
    public boolean onDoubleTap(MotionEvent e) {
    
        return false;
    }
    
    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        // TODO Auto-generated method stub
        return false;
    }
    
    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        // TODO Auto-generated method stub
        return false;
    }
    
    
    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
    

    }

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you guys had any experiences (positive or negative) by placing your source code/solution
Say I have mapview control in my Android app. If I know a landmark
I have a mapview and i put an annotation which shows a custom title
I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is
i have a mapView with pins on it, and the following code for CLLocation
I have a mapview where I want to track the user's current location. GPS
I have a MKMapView (also a UIPopoverControllerDelegate) with Annotations. This MapView has, in the
HI, I have a Mapview with some marker points + a marker for current
i'm developing an application for iPad. I have a mapview with several annotations. I
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.