Google maps extensions does not find fragment R.id.map

131 views Asked by At

I use google maps extensions library in my app, when I update android version to 5.0 I get NullPointerException at line:

mMap = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map)).getExtendedMap();

findFragmentById(R.id.map) is null Anybody knows why?

Thanks.

layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mapParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="fill_horizontal" >

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.androidmapsextensions.SupportMapFragment" /></RelativeLayout> 

LogCat:

12-08 11:56:57.544: E/AndroidRuntime(20846): FATAL EXCEPTION: main
12-08 11:56:57.544: E/AndroidRuntime(20846): java.lang.NullPointerException
12-08 11:56:57.544: E/AndroidRuntime(20846):  at com.analyticadesign.eds.MapPage.setUpMapIfNeeded(MapPage.java:422)
12-08 11:56:57.544: E/AndroidRuntime(20846):  at com.analyticadesign.eds.MapPage.onActivityCreated(MapPage.java:321)
12-08 11:56:57.544: E/AndroidRuntime(20846):  at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1794)
...

0

There are 0 answers