Ciao a tutti,
volevo porvi questa questione. Sto costruendo un applicazione con MapView, che al tocco sullo schermo di un punto sulla mappa mi restituisce l'indirizzo. Arrivato a questo punto:
try{
List <Address>addresses = geocoder.getFromLocation(p.getLatitudeE6()/1E6,p.getLongitudeE6()/1E6,1);
String add ="";
if (addresses.size()>0){
for(int i=0; i<addresses.get(0).getMaxAddressLineIndex(); i++){
add += addresses.get(0).getAddressLine(i)+"\n";
}
}
Toast.makeText(getBaseContext(), add, Toast.LENGTH_LONG).show();
}
catch (IOException e){
Toast.makeText(getBaseContext(),e.getMessage(),Toast.LENGTH_LONG).show();
}
}
else
return false;
return false;
}
}il try mi restituisce il toast con scritto "Service not available".
il logcat mi dice: E/MapActivity(376): Couldn't get connection factory client.
Ho girato il lungo e in largo tutto il web e il blog ma non ho trovato niente che facesse il caso mio.
C'e qualcuno che riuscirebbe ad aiutarmi?
Vi ringrazio in anticipo

Allego tutto il codice :
public class ProvaGeocoding extends MapActivity {
MapView mapView;
GeoPoint p;
MapController mc;
class MapOverlay extends com.google.android.maps.Overlay{
public boolean Draw(Canvas canvas, MapView mapview, boolean shadow, long when){
super.draw(canvas, mapview, shadow);
//Traduzione pixel geopoint dello schermo
Point screenPts = new Point();
mapView.getProjection().toPixels(p, screenPts);
//Aggiungo il marker
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);
return true;
}
public boolean onTouchEvent(MotionEvent event, MapView mapview){
//Avviene quando l'utente solleva il dito
if (event.getAction()==1){
GeoPoint p = mapView.getProjection().fromPixels((int) event.getX(), (int)event.getY());
mc.animateTo(p);
Geocoder geocoder = new Geocoder (getApplicationContext(), Locale.getDefault());
try{
List <Address>addresses = geocoder.getFromLocation(p.getLatitudeE6()/1E6, p.getLongitudeE6()/1E6, 1);
String add ="";
if (addresses.size()>0){
for(int i=0; i<addresses.get(0).getMaxAddressLineIndex(); i++){
add += addresses.get(0).getAddressLine(i)+"\n";
}
}
Toast.makeText(getBaseContext(), add, Toast.LENGTH_LONG).show();
}
catch (IOException e){
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
}
else
return false;
return false;
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mc = mapView.getController();
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mc.setZoom(12);
mc.setZoom(17);
//Aggiungo indicatore di posizione
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
mapView.invalidate();
}
protected boolean isRouteDisplayed() {
return false;
}
}