Google Map Android
I simply want to use google api but it doesn't work I dont see a tiny mistake I guess can you help me pls ?
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="HelloGoogleMaps"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView;
public class HelloGoogleMaps extends MapActivity {
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.map开发者_如何学运维view);
mapView.setBuiltInZoomControls(true);
}
}
Make sure you include inside the application tag
<uses-library android:required="true" android:name="com.google.android.maps" />
and inside the manifest tag include
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
also, do you include your api key in the MapView object in the main.xml file?
My MapView tag looks like:
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:enabled="true"
android:apiKey="api key here" />
精彩评论