java - Error in inflating map fragment -


i have navigation bar , working fragment, menu1fragment map, when tried use addtobackstack save data have problem in inflating solution

mainactivity

private void displayview(int position) {     fragment fragment = null;     string title = getstring(r.string.app_name);     switch (position) {         case 0:             fragment = new menu1_fragment();             title = getstring(r.string.title_section1);             break;         case 1:             fragment = new menu2_fragment();             title = getstring(r.string.title_section2);             break;         case 2:             fragment = new menu4_myfleet();             title = getstring(r.string.title_section3);             break;         case 3:             fragment = new menufragment_contact();             title = getstring(r.string.title_section4);             break;         case 4:             fragment = new menu5_emergency();             title = getstring(r.string.title_section5);             break;         case 5:             logoutuser();             break;         default:             break;     }      if (fragment != null) {         string backstatename = fragment.getclass().getname();         fragmentmanager fragmentmanager = getsupportfragmentmanager();         boolean fragmentpopped = fragmentmanager.popbackstackimmediate(backstatename, 0);         if (!fragmentpopped){ //fragment not in stack, create it.             fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();             fragmenttransaction.replace(r.id.container_body, fragment);             fragmenttransaction.addtobackstack(backstatename);             fragmenttransaction.commit();         }       /*  fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();         fragmenttransaction.replace(r.id.container_body, fragment);         fragmenttransaction.addtobackstack(null);         fragmenttransaction.commit();*/          // set toolbar title         getsupportactionbar().settitle(title);     } } 

this menu1_fragment inflate map:

  rootview = inflater.inflate(r.layout.activity_map,container,false);     /*get map fragment , puts in container */     fragmentmanager fm = getchildfragmentmanager();     fragment mapfragment = fm.findfragmentbyid(r.id.map);     if (mapfragment == null) {         mapfragment = supportmapfragment.newinstance();         fm.begintransaction().replace(r.id.container_body, mapfragment, "mymap")                 .commitallowingstateloss();     }       //create fragment contain vehicle     mfragment4container = (framelayout) rootview.findviewbyid(r.id.fragment4container);     mfragment4container.setvisibility(view.gone);     android.support.v4.app.fragmenttransaction trans = getactivity().getsupportfragmentmanager().begintransaction();     trans.add(mfragment4container.getid(), new menu3_fragment());     trans.commit();     //create fragmen marker profile     mfragment4containeruser = (framelayout) rootview.findviewbyid(r.id.fragment4containeruser);     mfragment4containeruser.setvisibility(view.gone);     android.support.v4.app.fragmenttransaction transprofile = getactivity().getsupportfragmentmanager().begintransaction();     transprofile.add(mfragment4containeruser.getid(), new user_info());     transprofile.commit(); 

this error appears:

android.view.inflateexception:binary xml file line #7: error inflating class fragment @  android.view.layoutinflater.createviewfromtag(layoutinflater.java:719) @  android.view.layoutinflater.rinflate(layoutinflater.java:761) @  android.view.layoutinflater.inflate(layoutinflater.java:498) @ android.view.layoutinflater.inflate(layoutinflater.java:398) @  com.example.fcb.insurance.menu1_fragment.oncreateview(menu1_fragment.java:120)   

menu1_fragment `

 <fragment 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" android:id="@+id/map" tools:context="com.example.fcb.insurance.map" android:name="com.google.android.gms.maps.supportmapfragment" />  <framelayout     android:id="@+id/fragment4container"     android:layout_width="match_parent"     android:layout_height="400dp"     android:background="#e2e2e2"     android:layout_gravity="bottom"     /> <framelayout     android:id="@+id/fragment4containeruser"     android:layout_width="match_parent"     android:layout_height="180dp"     android:background="#e2e2e2"     android:layout_gravity="bottom"     />  <com.rey.material.widget.button     style="@style/material.drawable.ripple.wave.light"     android:layout_width="256dp"     android:layout_height="wrap_content"     android:text="call expert"     android:id="@+id/buttonclose"     android:layout_marginbottom="100dp"     android:layout_gravity="center_horizontal|bottom"     app:rd_enable="true"/>  <com.rey.material.widget.button     style="@style/material.drawable.ripple.wave.light"     android:layout_width="256dp"     android:layout_height="wrap_content"     android:text="call tow truck"     android:id="@+id/button_towtruck"     android:layout_marginbottom="50dp"     android:layout_gravity="center_horizontal|bottom"     app:rd_enable="true"/> </framelayout> 

`

main activity.xml

  <!-- drawerlayout intended used top-level content view  using match_parent both width , height consume full space available. --> <android.support.v4.widget.drawerlayout    xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.fcb.insurance.mainactivity">   <linearlayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <linearlayout         android:id="@+id/container_toolbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical">          <include             android:id="@+id/toolbar"             layout="@layout/toolbar" />     </linearlayout>      <framelayout         android:id="@+id/container_body"         android:layout_width="fill_parent"         android:layout_height="0dp"         android:layout_weight="1" />   </linearlayout>       <!-- android:layout_gravity="start" tells drawerlayout treat      sliding drawer on left side left-to-right      languages , on right side right-to-left languages.      if you're not building against api 17 or higher, use      android:layout_gravity="left" instead. -->     <!-- drawer given fixed width in dp , extends full height      of     container. -->     <fragment     android:id="@+id/fragment_navigation_drawer"     android:name="com.example.fcb.insurance.fragmentdrawer"     android:layout_width="@dimen/nav_drawer_width"     android:layout_height="match_parent"     android:layout_gravity="start"     app:layout="@layout/fragment_navigation_drawer"     tools:layout="@layout/fragment_navigation_drawer"    />     </android.support.v4.widget.drawerlayout> 

remove android:name xml declaration, , replace with:

class="com.google.android.gms.maps.mapfragment"


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -