I am developing an Android app, which routes the user from current
location to a Parking spot(some random location) as the user moves on
the road. I am using GPS_PROVIDER to get the current location.

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
500,0,locationListener);

I am placing marker on the current location by using-

public void addMarkers()
{
//Adding Current location marker
    Drawable drawable_src =
this.getResources().getDrawable(R.drawable.mapmarker_pink);
    itemizedoverlay_src = new HelloItemizedOverlay(drawable_src,
this);
    GeoPoint src_point = new GeoPoint((int) (src_lat * 1E6),
            (int) (src_long * 1E6));
    overlayitem_src = new OverlayItem(src_point, "Current
Location",ConvertPointToLocation(src_point));
    itemizedoverlay_src.addOverlay(overlayitem_src);
    mapOverlays.add(itemizedoverlay_src);
}

I am using locationManager.getLastKnownLocation to intially get the
location, and then later OnLocationChanged method is called, where in
the location is updated, the previous marker is removed and new marked
is added to the current location-

private void updateMarker(GeoPoint point) {

    //Removing previous marker
    itemizedoverlay_src.removeOverlay(overlayitem_src);
    mapOverlays.remove(itemizedoverlay_src);

    //Adding Current location marker
    overlayitem_src = new OverlayItem(point, "Current
Location",ConvertPointToLocation(point));
    itemizedoverlay_src.addOverlay(overlayitem_src);
    mapOverlays.add(itemizedoverlay_src);

}

I am doing, this so that it appears as though the marker moves
continuously as the user's location is changed continuously. I am
requesting the for updates every 500ms. But when I tested the app on
the road network, The app turned out to be very slow, and gets hung
frequently. I am not sure, why this happens?? Is there something wrong
with my code? Is there a better efficient solution to this?

Please help me out

Thanks- Maneesh

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

Reply via email to