问题
Actually here I have followed tutorial for Google maps in android sdk using Google play service. But did not get any MapView
in my real device.please help to solve this issue.
回答1:
You must check if Google Play Service is installed in your device
Google Play services is used to update Google apps and apps from Google Play. This component gives you access to Google Settings and helps apps speed up offline searches, provide more immersive maps, and improve performance. Apps may not work if you uninstall Google Play services. You probably need this component.
Get it here
回答2:
Google maps for android is maps v2. Google maps v2 does not suppot mapview anymore(if you have an old api key it will work for maps v1, but if you need a new key they stopped the service). So I suggest you move on to maps v2 and make use of the below code or make use of the tutorial mentioned below the code
// Getting Google Play availability status
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
dialog.show();
}
else
{ // Google Play Services are available
// Getting reference to the SupportMapFragment
SupportMapFragment fragment = ( SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapfragment);
// Getting Google Map
mGoogleMap = fragment.getMap();
=============================================
you may also follow this tutorial http://www.vogella.com/articles/AndroidGoogleMaps/article.html
来源:https://stackoverflow.com/questions/17895658/displaying-mapview-in-an-android-device