Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-13724

Android: Maps V2: One mapView added over another mapView will be displayed only once until user performs some other device activity

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      MapModule, Titanium SDK 3.1.0, Mobile SDK.

      Description

      Adding one map view over another map view does not display map until we do some other activity and then launch the app.

      Steps to reproduce:
      1: Use the below mentioned code as sample to test.
      2: build the app using MapModule.
      3: deploy the app in android device and launch the app.
      4: press add one more map button.
      5: Second map is not displayed till now.
      6: press the recent app button if using nexus or some other activity.
      7: open app again and it will display map 2.

      *Sample code*

      var MapModule = require('ti.map');
      var win = Ti.UI.createWindow({fullscreen: false});
      var anno = MapModule.createAnnotation({latitude: -33.87365, image: 'map_pin.png', longitude: 151.20689, title: "Sydney", subtitle: "Sydney is quite chill", draggable: true});
      var anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: "Anno2", subtitle: "This is anno2", draggable: true});
      var anno3 = MapModule.createAnnotation({latitude: -33.85365, longitude: 151.20689, title: "Anno3", subtitle: "This is anno3", draggable: false});
      var anno4 = MapModule.createAnnotation({latitude: -33.86365, longitude: 151.22689, title: "Anno4", subtitle: "This is anno4", draggable: true});
       
      anno.addEventListener('click',function(e){
       
          alert(JSON.stringify(e));
       
      });
       
      Ti.API.info ("Latitude:" + anno.latitude);
      Ti.API.info ("Title:" + anno.title);
       
      var map = MapModule.createView({
          userLocation: true,
          mapType: MapModule.NORMAL_TYPE,
          animate: true,
          annotations: [anno, anno2, anno4],
          region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney
          top: '30%'
      });
      Ti.API.info("userLocation: " + map.userLocation);
      win.add(map);
       
      map.addEventListener('click', function(e) {
          Ti.API.info("Latitude: " + e.latitude);
          Ti.API.info("Source: " + e.clicksource);
      });
       
      var button8 = Ti.UI.createButton({top: '20%', right: 0, title: "Add one more Map"});
      button8.addEventListener('click', function(e) {
       
          var ddd = Titanium.UI.createView({
              backgroundColor:"#00F",
              top:'30%',
              zIndex:10000
          });
          win.add(ddd);
          var mapdet = MapModule.createView({
              userLocation: true,
              mapType: MapModule.NORMAL_TYPE,
              animate: true,
              annotations: [anno, anno2, anno4],
              region: {latitude: 47.040182, longitude: -119.223633, latitudeDelta: 0.1, longitudeDelta: 0.1 } //Sydney
          });
          ddd.add(mapdet);
      });
       
       
      win.add(button8);
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              hpham Hieu Pham
              Reporter:
              anigam Ashish Nigam
            • Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-16377
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code