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 8650681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:53:01+00:00 2026-06-12T13:53:01+00:00

I am using the google maps api with overlay items and want to be

  • 0

I am using the google maps api with overlay items and want to be able to get directions when the user clicks these overlays.

I want this linked to the middle button of my dialog:

// Middle button
    dialog.setNeutralButton("Directions",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
                            Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
                    intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

                    startActivity(intent);

                }
            });

I get the following error “The method startActivity(Intent) is undefined for the type new DialogInterface.OnClickListener(){}”

There are several answers to this on here but I cannot get any of them to work. I have tried both creating a constructor and calling getContext().

I am not sure if it is because my class is:

public class ItemizedOverlayLayoutActivity extends ItemizedOverlay {

Any help greatly appreciated.

Thanks

  • 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-06-12T13:53:02+00:00Added an answer on June 12, 2026 at 1:53 pm

    In the constructer of your class ItemizedOverlayLayoutActivity add a parameter Context:

    private Context context;
    public MyItemizedNewOverlay(Drawable defaultMarker, Context context) {
        //...
        this.context = context;
    }
    

    just before you create your dialog add:

    final Context fcontext = context;
    

    Then in the dialog middle button use:

    fcontext.startActivity(intent);
    

    good luck

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

Sidebar

Related Questions

I'm using google maps API 3 and a custom overlay (OverlayView) I have this
I want to add some custom roads using google maps api (i.e. off-road routes,
Update II I Figured this out. When using google maps api, the model must
I'm using the Google maps API (v2) to display a country overlay over a
I'm using Google Maps api v. 3 in my website. What I want to
I'm using Google Maps API v3 to draw circle overlays at specific locations (latitude
I am using Google API V3 and I want to have a ground overlay
For example, I am using Google Maps API and I want to see all
I have images to overlay on google maps by using checkboxes. I made this
I am Using Google maps api v3 and want to make markers using loop

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.