android - Blank Map Screen Open while using Google Maps Api v2 -
i trying use google maps api v2 , following steps in android google maps article
but after steps, code executed on glaxy young android 2.36 blank map screen displayed
my main activity code
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.showmapactivity_layout); fragmentmanager myfragmentmanager = getsupportfragmentmanager(); supportmapfragment mysupportmapfragment = (supportmapfragment)myfragmentmanager.findfragmentbyid(r.id.map); map = mysupportmapfragment.getmap(); //map = getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker hamburg = map.addmarker(new markeroptions().position(hamburg) .title("hamburg")); marker kiel = map.addmarker(new markeroptions() .position(kiel) .title("kiel") .snippet("kiel cool") .icon(bitmapdescriptorfactory .fromresource(r.drawable.ic_launcher))); // move camera instantly hamburg zoom of 15. map.movecamera(cameraupdatefactory.newlatlngzoom(hamburg, 15)); // zoom in, animating camera. map.animatecamera(cameraupdatefactory.zoomto(10), 2000, null); } maifestfile code is
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.archifiles.pointpakistan" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" android:targetsdkversion="10" /> <permission android:name="com.archifiles.pointpakistan.permission.maps_receive" android:protectionlevel="signature" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <uses-permission android:name="com.archifiles.pointpakistan.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.archifiles.pointpakistan.splashscreenactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".mainactivity"></activity> <activity android:name=".poiactivity"></activity> <activity android:name=".showmapactivity"></activity> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="aizasyde_pk7x98rwq2gtkaauuv0k0yri3trpua" /> <uses-library android:name="com.google.android.maps" android:required="true" /> </application> layout file code
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.supportmapfragment" /> </relativelayout> no log traces available in log cat.
actually used supportmapfragment. like
supportmapfragment gm; gm = ((supportmapfragment)(getsupportfragmentmanager().findfragmentbyid(r.id.map))).getmap(); so in xml file must use
<fragment android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" /> hope work.
remove below line in manifest
<uses-library android:name="com.google.android.maps" android:required="true" />
Comments
Post a Comment