こんにちは、Android マップ アプリのチュートリアルをいじっていますが、com.google.andoid.maps パッケージを適切にインポートしていないように見えるため、多くのエラーが発生しています。クラス。それが機能してはならない理由はありますか?
import com.google.android.maps.*;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class ShowTheMap extends MapActivity {
private static double lat;
private static double lon;
private int latE6;
private int lonE6;
private MapController mapControl;
private GeoPoint gp;
private MapView mapView;
private Button overlayButton, accessButton;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); // Suppress title bar for more space
setContentView(R.layout.showthemap);
// Add map controller with zoom controls
mapView = (MapView) findViewById(R.id.mv);
mapView.setSatellite(false);
mapView.setTraffic(false);
mapView.setBuiltInZoomControls(true); // Set android:clickable=true in main.xml
int maxZoom = mapView.getMaxZoomLevel();
int initZoom = maxZoom-2;
mapControl = mapView.getController();
mapControl.setZoom(initZoom);
// Convert lat/long in degrees into integers in microdegrees
latE6 = (int) (lat*1e6);
lonE6 = (int) (lon*1e6);
gp = new GeoPoint(latE6, lonE6);
mapControl.animateTo(gp);
// Button to control food overlay
overlayButton = (Button)findViewById(R.id.doOverlay);
overlayButton.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
}
});
// Button to control access overlay
accessButton = (Button)findViewById(R.id.doAccess);
accessButton.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
}
});
}
// Method to insert latitude and longitude in degrees
public static void putLatLong(double latitude, double longitude){
lat = latitude;
lon =longitude;
}
// This sets the s key on the phone to toggle between satellite and map view
// and the t key to toggle between traffic and no traffic view (traffic view
// relevant only in urban areas where it is reported).
public boolean onKeyDown(int keyCode, KeyEvent e){
if(keyCode == KeyEvent.KEYCODE_S){
mapView.setSatellite(!mapView.isSatellite());
return true;
} else if(keyCode == KeyEvent.KEYCODE_T){
mapView.setTraffic(!mapView.isTraffic());
mapControl.animateTo(gp); // To ensure change displays immediately
}
return(super.onKeyDown(keyCode, e));
}
// Required method since class extends MapActivity
@Override
protected boolean isRouteDisplayed() {
return false; // Don't display a route
}
}