Google Maps Android API v2 not show the map -
i've problem show map using google map android api v2.
the app debug dont show error when call activity blank mapview no map inside.
my code is:
activity_map.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <com.google.android.gms.maps.mapview android:id="@+id/map_view" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout>
mapvieweractivity
public class mapvieweractivity extends activity { mapview mapview; googlemap map; /** called when activity first created. */ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_map); // gets mapview xml layout , creates mapview = (mapview) findviewbyid(r.id.map_view); mapview.oncreate(savedinstancestate); // gets googlemap mapview , initialization stuff map = mapview.getmap(); map.getuisettings().setmylocationbuttonenabled(false); map.setmylocationenabled(true); mapsinitializer.initialize(this); // updates location , zoom of mapview cameraupdate cameraupdate = cameraupdatefactory.newlatlngzoom(new latlng(43.1, -87.9), 10); map.animatecamera(cameraupdate); }
any idea? tyvm read!
from google's documenation:
to use google maps android api v2, must register app project on google developers console , google api key can add app. type of api key need android key.
follow google's instructions here set maps api key
https://developers.google.com/maps/documentation/android/signup
in short:
- make project in google developers console
- generate key use maps api
- add key android manifest
Comments
Post a Comment