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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:24:30+00:00 2026-06-17T02:24:30+00:00

I create a map with overlays and i need when i press one of

  • 0

I create a map with overlays and i need when i press one of them to show me a dialog with a button and when i press the button to start another activity.How can i do that because i tried with startActivity(intent) but give me error.

public class MiItemizedOverlay extends ItemizedOverlay {

public MiItemizedOverlay(Context context, Drawable defaultMarker) {
    super(boundCenterBottom(defaultMarker));
    this.context = context;
}

public void addLocalizacion(double lat, double lon, String etiqueta) {
    int lt = (int) (lat * 1E6);
    int ln = (int) (lon * 1E6);
    punto = new GeoPoint(lt, ln);
    OverlayItem item = new OverlayItem(punto, etiqueta, null);
    mOverlays.add(item);
    populate();
}

public void clear() {
    mOverlays.clear();
    populate();
}

@Override
protected OverlayItem createItem(int i) {
    return mOverlays.get(i);
}

@Override
public int size() {
    return mOverlays.size();
}

@Override
protected boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet());
    dialog.setPositiveButton("Go", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            Intent intent = new Intent(context, OtraActivity.class);
            startActivity(intent);


        }
    }).create().show();
    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-06-17T02:24:32+00:00Added an answer on June 17, 2026 at 2:24 am

    Use the Context field of the MiItemizedOverlay class

    @Override
    protected boolean onTap(int index) {
        OverlayItem item = mOverlays.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(context);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet());
        dialog.setPositiveButton("Go", new DialogInterface.OnClickListener() {
    
            public void onClick(DialogInterface dialog, int id) {
                Intent intent = new Intent(context, OtraActivity.class);
                //here
                context.startActivity(intent);
            }
        }).create().show();
        return true;
    }
    

    also don’t forget to dismiss the dialog before calling other Activity

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

Sidebar

Related Questions

I want to create a Map object that can lose value only if we
I need to create a map, from integers to sets of tuples, the tuples
In Bash I can create a map (hashtable) with this common construction hput() {
I would like to remove all the overlays of my map at one point,
I hope someone can help with this. I have created a map app that
Very simple question, how can I create a draggable marker in an OpenLayers map,
I need to write a map service that returns a single, static map image
I'm trying to show a dialog box that says waiting for GPS fix on
I need to create a google maps web application, where I can import a
I have a circle on the a map that I need to update, here

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.