I have an activity with some TextViews that I update with current values from my service that runs in the background.
Thats working fine if I only update the TextViews.
I am getting also current LAT and LONG from the service to the activity, cause I am recording the driven distance in the background.
Now I want to show a small map under my values, so that I could see where I am.
But when I add the map, the TextViews are getting updated only one time, until the map starts I think. Only the map is updating, but the TextViews no longer.
What I am doing wrong?
My service binder in my activity:
// Bind to LocalService
Intent intent = new Intent(Dashboard.this, GPSService.class);
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
try{
if (mService.StartadressFlag==1){
doUpdate(); //This updates the TextViews with values from service
callMap(); //This calls the map with LAT and LONG from service
}
mHandler.sendEmptyMessageDelayed(MSG_UPDATE, UPDATE_RATE_IN_MS);
}
catch(final Exception ex){
//damn
Log.e("Dashboard", "Error in activity", ex); // log the error
}
}
};
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView = (MapView) findViewById(R.id.mapview);
// enable Street view by default
mapView.setStreetView(true);
// enable to show Satellite view
// mapView.setSatellite(true);
// enable to show Traffic on map
// mapView.setTraffic(true);
mapView.setBuiltInZoomControls(true);
mapController = mapView.getController();
mapController.setZoom(16);
What I am doing wrong?
OK, figured it out by myself.
I have added a own GPS-Listener in my activity for the map. So I do not need to get the LAT and LONG in the binder for the map. Then everything is working fine.