Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

android titanium route not working for me

$
0
0

my mapview's map has disappear upon adding in the route.

This is my codes

var map_win = Ti.UI.currentWindow;
 
map_win.backgroundColor = '#FFF';
 
map_win.open();
 
var btn_back = Ti.UI.createButton({
    title:'Back',
    color:'#000',
    top:5,
    left:5,
    height:30,
    width:50
});
map_win.add(btn_back);
 
btn_back.addEventListener('click', function(){
    Ti.UI.currentWindow.close();
});
 
 
var annotations=[
//{latitude:1.36252, longtitude:103.989372, title:"Changi", subtitle:"Big Sur"}
{latitude:1.306383,longitude: 103.778421, title:"Int School", subtitle:"INT SCH"}
,
{latitude:1.309844, longitude: 103.777113
, title:"KFC", subtitle:"Kentucky"},
];
 
 
var annotationObject=[];
 
Titanium.API.info(annotations.length);
 
for(var i=0;i<annotations.length;i++)
{
    annotationObject[i]=Titanium.Map.createAnnotation({
        latitude:annotations[i].latitude,
        longitude:annotations[i].longitude,
        title:annotations[i].title,
        subtitle:annotations[i].subtitle,
        pincolor:Titanium.Map.ANNOTATION_RED, // variable "annotation" is the data, for loop beelow,iterate over data array and create a annotation object used later byy map view and create a annotation object which is added to annotationobject array that is used by map view
        animate:true,
    });
}
 
 
var mapview = Titanium.Map.createView({
    top:50,
    mapType: Titanium.Map.STANDARD_TYPE,
    region: {latitude:1.309737, longitude: 103.778421, 
           latitudeDelta:0.01, longitudeDelta:0.01}, 
    animate:true,
    regionFit:true,
    userLocation:true,
    annotations:annotationObject
});
 
points =[
        {latitude:1.306383.latitude, longitude:103.778421.longitude},
        {latitude:1.309844.latitude, longitude:103.777113.longitude}
    ];
 
var route = MapModule.createRoute({
    name:"some name",
    color:"red",
    points:points,
    width:6
});
 
 
mapview.addRoute(route);
map_win.add(mapview);
please guide me where went wrong as i am new

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>