syagbasan / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 1 forks source link

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

Open GoogleCodeExporter opened 8 years ago

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

GoogleMap *map;
mMap = ((SupportMapFragment) 
getActivity().getSupportFragmentManager().findFragmentById(R.id.map)).getExtende
dMap();

When I debug this line, I detect that findFragmentById(R.id.map) is null.
Why R.Id.map is null? All project was compiled correctly.
Version of android-maps-exetnsions is 2.1.0. 

Can anybody help me?
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)
...

Original issue reported on code.google.com by martin.m...@gmail.com on 10 Dec 2014 at 8:19