android - Initialisation of MapFragment in Activity Failing -
i use following xml code create mapfragment:
<fragment android:id="@+id/map" android:name="com.google.android.gms.maps.supportmapfragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hashcoder.eegoomain.customerhomeactivity"/>
and in oncreate()
method, use following code initialize map:
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_customer_home); createnavigationdrawerfunction(); mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); }
but, when run code on phone (redmi note 4), shows following exception:
java.lang.runtimeexception: unable start activity componentinfo{com.hashcoder.eegoomain/com.hashcoder.eegoomain.customerhomeactivity}: android.view.inflateexception: binary xml file line #61: binary xml file line #61: error inflating class fragment
and code works fine in other devices. doing wrong?
Comments
Post a Comment