Maybe this is just an artifact of your example, but you allocate enough room for 5 points, but only populate 2. The other 3 may have different default values for ArrayList vs. Array.
On Tue, Oct 28, 2008 at 1:48 AM, Joshua Partogi <[EMAIL PROTECTED]>wrote: > > Dear all, > > I want to draw a Polyline from GMap, but I used ArrayList for adding > the points to be drawn and then convert this ArrayList to array as > such: > LatLng point; > List<LatLng> points = new ArrayList<LatLng>(5); > > point = LatLng.newInstance(-34.402130,150.899139); > points.add(point); > point = LatLng.newInstance(-34.402239,150.900324); > points.add(point); > > Polyline line = new Polyline( (LatLng[])points.toArray() ); > map.addOverlay(line); > > But if I used array for the points as such: > LatLng point; > LatLng[] points = new LatLng[5]; > point = LatLng.newInstance(-34.402130,150.899139); > points[0] = point; > point = LatLng.newInstance(-34.402239,150.900324); > points[1] = point; > > Polyline line = new Polyline( points ); > map.addOverlay(line); > It works. > > Why does the first lines of code does not work? Could anyone give me > an idea? > > Thank you. > > > -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---