Reputation: 445
public class Map extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
MapView mapView = (MapView) findViewById(R.id.myMapView1);
mapView.getController().animateTo(srcGeoPoint);
mapView.getController().setZoom(15);
}
the map.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/myMapView1"
android:layout_width="fill_parent"
android:layout_x="0px"
android:enabled="true"
android:clickable="true"
android:apiKey="Obtained Key here" android:layout_y="105px" android:layout_height="fill_parent">
</com.google.android.maps.MapView>
</LinearLayout>
I check the log there's only one red mark, Failed to find provider info for com.google.settings. everything else seems to be fine. I am wondering why the map is empty looking?
Upvotes: 0
Views: 201
Reputation: 2309
Please check logs whether you are not getting "unable to authenticate error from google server". If yes there is issue with map key. Map key should be generate on same system where you are running application. Also check whether you have google play account signed and location setting is enabled.
please check here for more details: https://developers.google.com/maps/documentation/android/start
Upvotes: 0
Reputation: 2688
Inside every MapActivity, the isRouteDisplayed() method is required, so override this method:
@Override protected boolean isRouteDisplayed() { return false; }
This method is required for some accounting from the Maps service to see if you're currently displaying any route information. In this case, you're not, so return false.
source: http://developer.android.com/resources/tutorials/views/hello-mapview.html
Additional the android:layout_x="0px
looks a little bit dodgy to me. I think it's only used in AbsoluteLayouts so deleting it should not harm.
Upvotes: 0
Reputation: 6131
The MapView is empty when your Maps API key is expired or not matching with your debug signature key. Try to generate a new one.
Upvotes: 4