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

  • SEARCH
  • Home
  • 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 6863265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:45:42+00:00 2026-05-27T02:45:42+00:00

In order to detect map movements and gestures and use the lazy loading support

  • 0

In order to detect map movements and gestures and use the lazy loading support for my map items I’m trying to work with this library: http://code.google.com/p/mapview-overlay-manager/.

I’ve setup a map attached the overlayManager and the events are coming through just fine. I can throw a toast from the listener just fine. When I get Application context it is not null.

I’m stuck trying to launch an intent from the ManagedOverlay class. Specifically in the onDoubleTap method below I’m trying to launch an intent and I get this error message:

 Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

I think I generally understand that I need to call back to the MapActivity subclass and have it launch the intent or I need to do something with the context differently. I’m having trouble ironing out the specifics however. Any assistance appreciated.

public class SiteMapRev2 extends MapActivity {

    private MapView mapView;
    private OverlayManager overlayManager;
    private MapController mapController;
    private MyLocationOverlay userLocationOverlay;
    private ArrayList<SiteSummary> sitesRoster = null;
    private Drawable siteIcon;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map);

        mapView = (MapView) findViewById(R.id.mapview);      
        mapView.setBuiltInZoomControls(true);

        overlayManager = new OverlayManager(this, mapView);

        sitesRoster = new ArrayList<SiteSummary>(); 
        userLocationOverlay = new MyLocationOverlay(this, mapView);

        mapView.getOverlays().add(userLocationOverlay);
        mapController = mapView.getController();
        mapController.setZoom(14);
        siteIcon = this.getResources().getDrawable(R.drawable.marker2);

    }



    @Override
    public void onStart() {
        super.onStart();
        Drawable defaultmarker = getResources().getDrawable(R.drawable.marker2);

        ManagedOverlay managedOverlay = overlayManager.createOverlay("sites", defaultmarker);

        managedOverlay.setOnOverlayGestureListener(new ManagedOverlayGestureDetector.OnOverlayGestureListener(){

            public boolean onDoubleTap(MotionEvent arg0, ManagedOverlay arg1,
                    GeoPoint arg2, ManagedOverlayItem arg3) {

                if (arg3 == null) {
                    return false;
                }
                else {
                    **SiteOverlayItem thisItem = (SiteOverlayItem) arg3;
                    String siteIDAsString = Integer.toString(thisItem.getSiteID());
                    Context c = getApplicationContext();
                    Intent showSiteDetails = new Intent(c,SiteDetailActivity.class);
                    Log.d(toString(), "intent = " + showSiteDetails.toString());
                    showSiteDetails.setData(Uri.parse(siteIDAsString));
                    c.startActivity(showSiteDetails);
                    return true;**
                }

            }
  • 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-27T02:45:43+00:00Added an answer on May 27, 2026 at 2:45 am

    Instead of getting the application context, I would do this:

    SiteMapRev2.this.startActivity(showSiteDetails);
    

    which starts the activity from your map activity as you normally would.

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

Sidebar

Related Questions

I am trying to use a kinect device in order to detect the palm
I need to detect IE6 in order to work around the lack of position:fixed.
Can I detect all the visible sprites in a layer in order to use
I need to use JQuery in order to detect the changes on a text
Is there a way for class library to detect when it's loaded, in order
I am trying to use Python in order to manipulate a text file from
I am trying to detect if an array isn't empty in order to be
In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary
I am trying to built a simple game in Java.In Flash/Actionscript in order to
I have a custom view subclassed from GridView that I use in order to

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.