Hi everyone!

I'm working with google map on android right now. But now i'm stuck
with loading more then 500 overlays on the map. It take too much time
and some time it crash because of using too much resource  (CPU over
90%).

Here it is my code :


        public void initArrayPostion(List<Attraction> attraction){
                for(int i=0;i<attraction.size();i++){

                Double latitude =
Double.valueOf(attraction.get(i).latitude)* 1E6;
                Double longitude =
Double.valueOf(attraction.get(i).longitude) * 1E6;

                if (latitude.intValue() != 0 && longitude.intValue() !=0)  {
                minLatitude = (minLatitude > latitude.intValue()) ?
latitude.intValue() : minLatitude;
                maxLatitude = (maxLatitude < latitude.intValue()) ?
latitude.intValue() : maxLatitude;

                // Sets the minimum and maximum latitude so we can
span and zoom
                minLongitude = (minLongitude > longitude.intValue()) ?
longitude.intValue() : minLongitude;
                maxLongitude = (maxLongitude < longitude.intValue()) ?
longitude.intValue() : maxLongitude;

               // mPoints.add(new Point(latitude.intValue(),
longitude.intValue()));

            }
                GeoPoint point = new GeoPoint(latitude.intValue(),
longitude.intValue());
                OverlayItem overlayitem =new OverlayItem(point,
DataStore.myAttraction.get(i).name, i+"");

                itemizedOverlay.addOverlay(overlayitem);
                }

        mapOverlays.add(itemizedOverlay);

        mapController.zoomToSpan((maxLatitude - minLatitude),
(maxLongitude - minLongitude));
        mapController.animateTo(new GeoPoint((maxLatitude +
minLatitude)/2,(maxLongitude + minLongitude)/2 ));
        }

This code use itemizedOverlay to add object in google map and i pass
array of attraction (each attraction have longitude and latitude and
many thing elses) as argument.

what is the problem ?? Thank u in advance for ur kindness :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to