[TIMOB-13724] Android: Maps V2: One mapView added over another mapView will be displayed only once until user performs some other device activity
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-05-02T20:21:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | map, mobilesdk, module, titanium |
Reporter | Ashish Nigam |
Assignee | Hieu Pham |
Created | 2013-04-23T08:59:58.000+0000 |
Updated | 2017-03-17T17:56:37.000+0000 |
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();
Video Link Show casing the issue: http://youtu.be/U5lnWkF2Dqc
Android Map v2 uses SurfaceView to draw the maps. You can't overlap 2 SurfaceViews. It is an Android limitation and you can find more info here: https://groups.google.com/forum/?fromgroups=#!topic/android-developers/COffLpanlz0 One possible workaround would be to remove the previous map then add the new one.
Closing ticket as invalid.