我从一个例子做同样的事情,但 Eclipse 返回错误。代码如下:
package hello.google.map;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class MapsActivity extends MapActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
这是错误:
*
Description Resource Path Location Type
MapActivity cannot be resolved to a type HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 7 Java Problem
MapActivity cannot be resolved to a type HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 13 Java Problem
The import com.google cannot be resolved HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 3 Java Problem
The import com.google cannot be resolved HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 4 Java Problem
The method isRouteDisplayed() of type MapsActivity must override a superclass method HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 18 Java Problem
The method onCreate(Bundle) of type MapsActivity must override a superclass method HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 11 Java Problem
The method setContentView(int) is undefined for the type MapsActivity HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 14 Java Problem
The public type MapsActivity must be defined in its own file HelloGoogleMapsActivity.java /HelloGoogleMaps/src/hello/google/map line 7 Java Problem*
为什么?我做错了什么?