I am trying to create a mapview in tabbar window but my application crashes badly whenever I try to add mapview. I even try to add to add a view and add my mapview onto it and add that view onto window but application is still crashes sometime randomly. My focus is being called twice I am enclosing my code as below aswell. Looking for urgent suggestions.
var mapview = Titanium.Map.createView({ top:0, height: 391, mapType: Titanium.Map.STANDARD_TYPE, region:{latitude:latStr, longitude:lonStr, latitudeDelta:0.2, longitudeDelta:0.2}, animate:true, regionFit:true, userLocation:false, //annotations:[atlanta1,appleAnn], }); if (latStr || lonStr) { mapview.region = {latitude:latStr, longitude:lonStr, latitudeDelta:0.2, longitudeDelta:0.2}; } if (!appleAnn) { mapview.annotations = [atlanta1]; } else { if (atlanta1) { mapview.annotations = [atlanta1,appleAnn]; } } //win4.add(mapview); // Applications crashes whenever I visit map tabSo I add mapview in focus as
var mapHolder = Ti.UI.createView({ size:{height:391, width:'auto'}, top:86, left:0, //backgroundImage:'../images/bkg-header.png', backgroundColor:'#000', modal:true, //borderColor:'blue', zIndex:0 }); win4.add(mapHolder); var mapCheck = false; var focusCheck = false; win4.addEventListener('focus', function(e) { if (focusCheck == false) { if (mapview) { var children = mapHolder.children.slice(0); for (var i = 0; i < children.length; ++i) { mapHolder.remove(children[i]); } } //alert('focus Check'); mapCheck = true; focusCheck = true; mapHolder.add(mapview); /*if (mapview) { win4.remove(mapview); } win4.add(mapview);*/ } })But my code for adding mapview didnt workout and event Listener 'open' is also not being callled. I m bit frustrated that why mapview is creating crahes on Android, although all annotations work is also being done.
Your Answer
Think you can help? Login to answer this question!