I get the Error
Unable to start activity ComponentInfo{de.androidbuch.activiti/de.androidbuch.activiti.task.Activity}: android.view.InflateException: Binar
I got the same error, but my issue was that my fragment did not have an id in the xml layout of the parent activity.
If you don't want to change anything and go with "fragment" tag
do this,
<fragment
android:visibility="gone" (Visibility will not work, just helps in removing frag from xml viewer)(If you want the visibility to be gone make it in your fragment root element visibility=gone)
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.YOUR_FRAGMENT" (This is important)
/>
Learnt this the hard way - if you nest an XML layout based <fragment>
tag inside a (potentially) dynamically loaded fragment from FragmentManager
, then you start to get weird errors, trying to inflate your fragment xml.
Turns out, that this is not supported - it will work fine if you do this through purely the FragmentManager
approach.
I was getting this problem because I was trying load a fragment inside a <DrawerLayout>
from xml, and this was causing a crash in the onCreateView()
method when I popped the back stack.
I had the same problem. The solution for me was the order of super.onCreate and setContentView within the FragmentActivity
Following order works fine:
super.onCreate(savedInstanceState);
setContentView(R.layout.fc_activity_list_profiles);
For me it was after scrolling in the stack trace i found im missing the permission for android.permission.ACCESS_NETWORK_STATE
after adding this permission it was fixed
My problem in this case was a simple instance of having a dumb null pointer exception in one of my methods that was being invoked later in the lifecycle. This was causing the "Error inflating class fragment" exception for me. In short, please remember to check the further down the exception stack trace for a possible cause.
Once I resolved the null pointer exception, my fragment loaded fine.