我想在我的Android應用程序中顯示特定的地方。我已經生成了Fingeprint密鑰並將其提交給Google並獲得了一個API密鑰。在Android應用程序中顯示地圖的問題
但還是在我的編碼有很多的錯誤,主要錯誤在以下導入文件
{import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MapView.LayoutParams;}
以下是我的應用程序的代碼
{
public class ViewMap extends MapActivity
{
MapView mapView;
MapController mc;
GeoPoint p;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mapview);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
mc = mapView.getController();
String coordinates[] = {"1.352566007", "103.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
}
protected boolean isRouteDisplayed()
{
return false;
}
}
}
我有很多的錯誤裏面的編碼也是如GeoPoint,mc,MapView等
請幫我解決這個問題
我必須添加任何新的包com.google.android與類文件,如MapView,GeoPoint等.... – 2011-03-26 05:24:26