Android MapFragment :Error inflating class fragment -


i have horizontal list of images, when click on image loads dialog fragment.the dialog fragment contains viewpager. view pager loads mapfragment inside pageradapter. here how it,

@override     public object instantiateitem(viewgroup collection, int position) {         final loyaltyoutlet outlet = data.get(position);         layoutinflater inflater = layoutinflater.from(context);         viewgroup layout = (viewgroup) inflater.inflate(r.layout.fragment_shop_item, collection, false);         textview address = (textview)layout.findviewbyid(r.id.txt_shopaddress);         supportmapfragment mapfragment = (supportmapfragment) fragmentmanager.findfragmentbyid(r.id.shopmap);         mapfragment.getmapasync(new onmapreadycallback() {             @override             public void onmapready(googlemap googlemap) {                 // adding marker                 markeroptions marker = new markeroptions().position(                         new latlng(outlet.getlattitude(), outlet.getlongitude())).title(                         outlet.getoutletname());                 marker.icon(bitmapdescriptorfactory                         .defaultmarker(bitmapdescriptorfactory.hue_orange));                 googlemap.addmarker(marker);                 cameraupdate cameraupdate = cameraupdatefactory.newlatlngzoom(new latlng(outlet.getlattitude(), outlet.getlongitude()), 10);                 googlemap.animatecamera(cameraupdate);             }         }); //        googlemap googlemap = ((supportmapfragment) fragmentmanager.findfragmentbyid(r.id.shopmap)).getmap();          address.settext(outlet.getoutletname() +"\n"+outlet.getoutletbulding()+" "+outlet.getoutletstreet()+"\n"+outlet.getoutletlocality());          collection.addview(layout);         return layout;      } 

here scenario have. when screen loaded horizontal list of images, tap on image load dialogfragment map. on initial load works fine. if load same dialog fragment again error inflates layout inside instantiateitem,

android.view.inflateexception: binary xml file line #38: error inflating class fragment

here fragment_shop_item.xml

<framelayout 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"              xmlns:attrs="http://schemas.android.com/apk/res-auto">       <linearlayout         android:orientation="vertical"         android:layout_width="match_parent"         android:layout_height="match_parent">          <relativelayout             android:layout_width="match_parent"             android:layout_height="0dp"             android:layout_weight=".25">              <com.mobytz.utils.customfonttextview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:textappearance="?android:attr/textappearancemedium"                 android:text="medium text"                 android:id="@+id/txt_shopaddress"                 android:layout_alignparenttop="true"                 android:layout_alignparentleft="true"                 android:layout_alignparentstart="true"                 attrs:customfont="handy_bold"                 android:textcolor="@color/android:black"                 android:textsize="8pt"                 android:layout_marginleft="10dp"/>         </relativelayout>          <relativelayout             android:layout_width="match_parent"             android:layout_height="0dp"             android:layout_weight=".75">             <fragment                 android:id="@+id/shopmap"                 android:name="com.google.android.gms.maps.supportmapfragment"                 android:layout_width="match_parent"                 android:layout_height="match_parent"/>         </relativelayout>     </linearlayout> </framelayout> 

not sure whats going wrong here.

thanks.


Comments