android - Binary XML file line #41: Error inflating class fragment -


error in log: pastebin.com/ylvmkad4

fragmentsettings.class:

package com.android.app;  import android.os.bundle; import android.preference.listpreference; import android.preference.preferencefragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup;  public class fragmentsettings extends preferencefragment {      [..]      @override         public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {              mlistpreference = (listpreference) getpreferencemanager().findpreference("preference_key");              return inflater.inflate(r.layout.activity_main, container, false);         } } 

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/drawer"     android:layout_width="match_parent"     android:fitssystemwindows="true"     android:layout_height="match_parent">      <linearlayout android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="vertical">          <include             android:id="@+id/toolbar_actionbar"             layout="@layout/toolbar_default"             android:layout_width="match_parent"             android:layout_height="wrap_content" />          <framelayout             android:id="@+id/container"             android:layout_width="match_parent"             android:clickable="true"             android:layout_height="match_parent">             <listview                 android:id="@android:id/list"                 android:layout_width="match_parent"                 android:layout_height="match_parent">             </listview>         </framelayout>     </linearlayout>     <!-- android:layout_margintop="?android:attr/actionbarsize"-->     <com.android.app.scriminsetsframelayout         android:id="@+id/scriminsetsframelayout"         android:layout_width="@dimen/navigation_drawer_width"         android:layout_height="wrap_content"         android:fitssystemwindows="true"         android:layout_gravity="start"         app:insetforeground="#4000"         android:elevation="10dp">          <fragment             android:id="@+id/fragment_drawer"             android:name="com.android.app.navigationdrawerfragment"             android:layout_width="@dimen/navigation_drawer_width"             android:layout_height="match_parent"             android:fitssystemwindows="true"             app:layout="@layout/fragment_navigation_drawer" />     </com.android.app.scriminsetsframelayout>   </android.support.v4.widget.drawerlayout> 

devices:

oppo n1, android 4.2.2 samsung galaxy note 1, android 5.1.1 

i've spent hours , hours error , couldn't find it. clue same app working on android 5.1.1.

additional:

mainactivity.java pastebin.com/a2nzlzfm

navigationdrawerfragment.java pastebin.com/pqtmipp3

fragment_navigation_drawer.xml pastebin.com/eveadv17

<fragment      android:id="@+id/fragment_drawer"      android:name="com.android.app.navigationdrawerfragment"      android:layout_width="@dimen/navigation_drawer_width"      android:layout_height="match_parent"      android:fitssystemwindows="true"/> 

use rather, , inflate layout in oncreateview() android take care of adding viewgroup/window etc etc

it line in mainactivity

 // set drawer.     mnavigationdrawerfragment.setup(r.id.fragment_drawer,               (drawerlayout) findviewbyid(r.id.drawer), mtoolbar); 

remove , error go. next thing let activity handle drawerlayout himself. transfer drawer codes activity , forget setup() method in fragment

the reason since declared fragment embeded in activity, android initiates you, not need set up

hope works


Comments

Popular posts from this blog

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

node.js - Using Node without global install -

java - JavaScript + Thymeleaf - select onchange -