Android初心者です。 下記コードでエラーとなり、解決策が見当たらず、非常に困っています。 どなたがご教授をお願いします。 public class MapViewSample extends MapActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView mapView = (MapView)findViewById(R.id.MapView01); mapView.setClickable(true); mapView.setBuiltInZoomControls(true); ConcreteOverlay overlay = new ConcreteOverlay(this); List<Overlay> overlayList = mapView.getOverlays(); overlayList.add(overlay); } protected boolean isRouteDisplayed() { return false; } private class ConcreteOverlay extends Overlay { GeoPoint mGeoPoint; Geocoder mGeocoder; ConcreteOverlay(Context context) { mGeocoder = new Geocoder(context, Locale.JAPAN); } public boolean onTap(GeoPoint point, MapView mapView) { mGeoPoint = point; try { TextView textView = (TextView)findViewById(R.id.TextView01); boolean success = false; ★ここでエラー⇒List<Address>addressList = mGeocoder.getFromLocation(point.getLatitudeE6()/1E6, point.getLongitudeE6()/1E6, 5); for (Iterator<Address> it=addressList.iterator(); it.hasNext();) { Address address = it.next(); String country = address.getCountryName(); String admin = address.getAdminArea(); String locality = address.getLocality(); if(country != null && admin != null & locality != null) { textView.setText(country + admin + locality); success = true; break; } } if(!success) textView.setText("Error"); textView.invalidate(); } catch (Exception e){ Toast.makeText(getApplicationContext(), "ErrorToast", 1000).show(); } return super.onTap(point, mapView); } public void draw(Canvas canvas, MapView mapView, boolean shadow) { ・・・省略・・・ } } }
↧