Binary XML file line #9: Error inflating class fragment

后端 未结 3 403
情书的邮戳
情书的邮戳 2021-01-11 12:11

Am getting Error inflating fragment error while running calling an Activity which having fragments.

CheckList is Activity which contains listview

相关标签:
3条回答
  • 2021-01-11 12:57

    Your activity CheckList should extend FragmentActivity .

    0 讨论(0)
  • 2021-01-11 12:57

    I just removed onCreateView code which contains inflating xml in listview fragmentand move into onActivityCreated method with that its working.

    The reason may be:
    

    ListFragment has a default layout that consists of a single list view. However, if you desire, you can customize the fragment layout by returning your own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle). To do this, your view hierarchy must contain a ListView object with the id "@android:id/list" (or list if it's in code)

    So my listview extends ListFragment and not conatining list in xml , and directly we can setListAdapter in onActivityCreated rather than in onCreateView.

    0 讨论(0)
  • 2021-01-11 13:01

    <fragment class="com.uday.honeytest.CheckList$Description" is where it's getting the error.

    Are you sure you have the fully qualified class name typed correctly?

    Have you tried cleaning your project/fixing project properties?

    I don't see anything named Description in that class, that may be the issue.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题