Android: Unable To Inflate Activity_main Due To Fragment Added In It
I am getting these three errors while it starts the app and it crashes immediately after that(I've added all the references where required): android.view.InflateException: Binary X
Solution 1:
Change your:
<fragment
android:id="@+id/drawer_fragment"
android:name="com.tifinnearme.priteshpatel.materialdrawer.NavigationFragment"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation"
tools:layout="@layout/fragment_navigation" />
to be:
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
then add your fragment to content_frame
:
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction
.replace(R.id.content_frame, new your_fragment)
.commit();
Post a Comment for "Android: Unable To Inflate Activity_main Due To Fragment Added In It"