android - How to show google map v2 in Fragment? -
i have frame layout, show fragments, how can show google map frame_layout. make next:
- get api key
add google play services library nullpointerexeption, maybe knows examples how use it? car_waches.xml
fragment class:
public class fragmentcarwashes extends sherlockfragment { view v; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { googlemap map = ((supportmapfragment) getfragmentmanager().findfragmentbyid(r.id.mapfragment)) .getmap(); v = inflater.inflate(r.layout.fragment_car_washes, null); return v; } }
manifet file
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minsdkversion="10" android:targetsdkversion="17" /> <permission android:name="com.example.cars51ru.permition.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com.example.cars51ru.permition.maps_receive" /> <uses-permission android:name="android.permission.call_phone" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/theme.sherlock.light" > <meta-data android:name="com.google.android.maps.v3.api_key" android:value="api key" /> <activity android:name="com.example.cars51ru.splashactivity" 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="com.example.cars51ru.mainactivity" android:label="@string/app_name" > </activity> <uses-library android:name="com.google.android.maps" /> </application> </manifest>
i not versed in serlock stuff bu believe need use sherlockmapfragment
edit:
take @ link
Comments
Post a Comment