Performance issue on Android's MapView Navigation-App
Posted
by poeschlorn
on Stack Overflow
See other posts from Stack Overflow
or by poeschlorn
Published on 2010-06-15T13:06:34Z
Indexed on
2010/06/15
13:12 UTC
Read the original article
Hit count: 356
Hey Guys,
I've got a question on making an navigation app more faster and more stable.
The basic layer of my app is a simple mapview, covered with several overlays (2 markers for start and destination and one for the route).
My idea is to implement a thread to display the route, so that the app won't hang up during the calculation of a more complex route (like it does right now).
After implementing the thread there are no updates shows any more, maybe you can help me with a short glance at an excerpt of my code below:
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
posUser = new GeoPoint((int) (loc.getLatitude() * 1E6), (int) (loc
.getLongitude() * 1E6));
new Thread(){
public void run(){
mapView.invalidate();
// Erase old overlays
mapView.getOverlays().clear();
// Draw updated overlay elements and adjust basic map settings
updateText();
if(firstRefresh){
adjustMap();
firstRefresh = false;
}
getAndPaintRoute();
drawMarkers();
}
};
}
Some features have been summarized to a method like "drawMarkers()" or "updateText()"...(they don't need any more attention ;-))
© Stack Overflow or respective owner