Created
February 3, 2012 16:14
-
-
Save egomez99/1730910 to your computer and use it in GitHub Desktop.
2 MapViews in Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor:'red', | |
fullscreen: false, | |
tabBarHidden: true | |
}); | |
var win1 = Ti.UI.createWindow({url: 'map1.js'}); | |
var win2 = Ti.UI.createWindow({url: 'map2.js'}); | |
var annotationParams1 = { | |
latitude : 47.2080802920, | |
longitude : 11.6656994820, | |
latitudeDelta : 0.4, | |
longitudeDelta : 0.4, | |
title : 'Map1', | |
}; | |
var annotationParams2 = { | |
latitude: 37.389569, | |
longitude: -122.050212, | |
latitudeDelta : 0.4, | |
longitudeDelta : 0.4, | |
title : 'Map1', | |
}; | |
//Single instance of mapView that is going to be shared | |
var AndroidMapView = Titanium.Map.createView({}); | |
var btn1 = Ti.UI.createButton({ | |
title:'map1', top: 15 | |
}); | |
btn1.addEventListener('click',function(){ | |
AndroidMapView.mapType = Ti.Map.HYBRID_TYPE; | |
AndroidMapView.region = annotationParams1; | |
win1.sharedMapView = AndroidMapView; | |
win1.open(); | |
}); | |
win.add(btn1); | |
var btn2 = Ti.UI.createButton({ | |
title:'map2', top: 95 | |
}); | |
btn2.addEventListener('click',function(){ | |
AndroidMapView.mapType = Ti.Map.STANDARD_TYPE; | |
AndroidMapView.region = annotationParams2; | |
win2.sharedMapView = AndroidMapView; | |
win2.open(); | |
}); | |
win.add(btn2); | |
win.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = Ti.UI.currentWindow; | |
map = window.sharedMapView; | |
window.add(map); | |
map.addEventListener('click', function(){ | |
alert('nel'); | |
window.close(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = Ti.UI.currentWindow; | |
map = window.sharedMapView; | |
window.add(map); | |
map.addEventListener('click', function(){ | |
window.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment