Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Make map annotation display on map load in android?

Is there a way to make a map annotation tooltip show up when the map is first loaded in Android? In IPhone it does this automatically, it pops up the tooltip with the title and subtitle. However in Android, you have to click on the pin in order to pop up the tooltip.

— asked December 2nd 2010 by Justin Toth
  • mapview
0 Comments

1 Answer

  • Just select that annotation when containing window is opened (which is indicated by event).

    Example:

    // define annotation to show on map
    var annotation = Titanium.Map.createAnnotation(location);
    
    // create map with annotation in the center
    var mapView = Titanium.Map.createView({
      mapType: Titanium.Map.STANDARD_TYPE,
      region: {
        latitude: location.latitude,
        longitude: location.longitude,
        latitudeDelta: 0.001,
        longitudeDelta: 0.001
      },
      animate: true,
      regionFit: true,
      userLocation: false,
      annotations:  [annotation]
    });
    
    // select annotation to show it's tooltip when window is opened
    window.addEventListener('open', function () {
      mapView.selectAnnotation(annotation);
    });
    
    // add map to window
    window.add(mapView);
    
    // open window with prepared view
    window.open();
    
    — answered January 26th 2011 by Sebastian Kremiec
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.