在下面的代码中,当我使用位置控件切换位置时,地图的背景变为黑色。如何取回地图视图的显示?
private class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location loc)
{
if(loc!=null)
{
Geocoder geocoder = new Geocoder(getBaseContext(), Locale.getDefault());
try
{
List<Address> addresses = geocoder.getFromLocation(loc.getLatitude() / 1E6, loc.getLongitude() / 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_SHORT).show();
}
catch(IOException e)
{
e.printStackTrace();
}
}
p = new GeoPoint((int)(loc.getLatitude() * 1E6),
(int)(loc.getLongitude() * 1E6));
mc.animateTo(p);
mc.setZoom(18);
}
public void onProviderDisabled(String provider)
{
}
public void onProviderEnabled(String provider)
{
}
public void onStatusChanged(String provider, int status, Bundle extras)
{
}
}