Reputation: 4283
I was changing a Activity to a Fragment to use inside a Scrollable Tab Activity. But I getting this exception I load this fragment:
FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #17: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.zhensydow.demo.MainMenuFragment.onCreateView(MainMenuFragment.java:43)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
....
And the used (simplified) xml loaded is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
... >
<fragment <<---- LINE #17
android:id="@+id/mlist"
android:name="com.zhensydow.demo.MListFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
tools:layout="@android:layout/mcontent" />
<FrameLayout ... />
</LinearLayout>
The error is caused in this code:
public class MainMenuFragment extends Fragment implements
MenuListFragment.Callbacks {
// ...
@Override
public View onCreateView( LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
super.onCreateView(inflater, container, savedInstanceState);
LinearLayout ll = (LinearLayout) inflater.inflate(
R.layout.activity_main_menu, container, false);
return ll;
}
// ...
}
The error is on a fragment, I think it's caused because the old activity loaded two fragments inside him.
How can I solve it?
UPDATE: added full fragmen xml data
Upvotes: 0
Views: 344