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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:11:29+00:00 2026-05-23T10:11:29+00:00

I have a map activity that has many pins of map, and when I

  • 0

I have a map activity that has many pins of map, and when I click a pin, a custom balloon opens, showing some information about that pin. Also, I have a search bar, where if you type the name of a knob, the info appears there, but I want it to go to that searched pin.
Example: on the map you have different vegetables pins, and when you search carrot, the search list will show the element carrot, and when you click on it, the balloon for the carrot pin will inflate. So, my question is : is there some sort of OnTap() void method ? I know, that OnTap(int index) returns a boolean.

  • 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-23T10:11:29+00:00Added an answer on May 23, 2026 at 10:11 am

    create your own itemized overlay, and override the onTap method, and in your main class, make an instance of the itemized overlay, and call overlay.onTap(point)

    Sample code:

    public class MyItemizedOverlay<Item> extends ItemizedOverlay<OverlayItem> {
        private ArrayList<OverlayItem> m_overlays;
        private MapView mapView;
        final MapController mc;
    
        public MyItemizedOverlay(Drawable defaultMarker, MapView mapView) {
            super(boundCenterBottom(defaultMarker), mapView);
            m_overlays = new ArrayList<OverlayItem>();
            mc = mapView.getController();
            populate();
        }
    
        public void addOverlay(OverlayItem overlay) {
            m_overlays.add(overlay);
            setLastFocusedIndex(-1);
            populate();
        }
    
        public ArrayList<OverlayItem> getOverlays() {
            return m_overlays;
        }
    
        public final boolean onTap(int index) {
            GeoPoint point;
            point = createItem(index).getPoint();
            mc.animateTo(point);    
            return true;
        }
    
        ...
    }
    

    In the main class

    public class Main extends MapActivity {
        private MapView mapView;
    private List<Overlay> mapOverlays;
        private MyItemizedOverlay overlay;
    private Drawable pin;
    
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            doAction();
        }
    
        private void doAction() {
        mapView = (MapView)findViewById(R.id.map_view);
            pin = res.getDrawable(R.drawable.pin);
    
            overlay = new MyItemizedOverlay(pin, mapView);
    
            GeoPoint point = new GeoPoint((int)(7*1E6),(int)(42*1E6));
            overlayItem = new OverlayItem(point, "title", "text");
    
        overlay.addOverlay(overlayItem);
    
            mapOverlays = mapView.getOverlays();
        mapOverlays.add(overlay);
    
            //we tap the point here
            overlay.onTap(0);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Activity that opens the Camera and starts a preview on a
I have an activity that extends MapActivity. I want to show map inside a
I have this MapActivity class below showing a map and putting a pin of
can i use fragments and map view in the same activity. I have seen
I have map with multiple different colors markers with some info window. Everything works
I have a map that i want to update from a separate thread. Im
I have image map that can I move, but this map will be so
I have a single activity app that uses a PagerAdapter. In the OnCreate event
I have a Map activity in a fairly complex layout. As such, I can't
I have an app that has been pretty stable so far, and I decided

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.