Populate ListFragments with a custom view?

纵饮孤独 提交于 2019-12-05 06:59:58

I cannot remember for sure if this is what solved this problem when I had it, but I don't think you are correctly following the fragment lifecycle (seen here).

In the context of talking about an activity, you must first create your ListView before making calls like setAdapter(). You are implementing in onCreate() which is called before onCreateView().

So it simply seems like you are in essence trying to set the adapter of your ListView before you have created it.

As a habit, it is always best to do all of your work with views within the onCreateView() part of the fragment lifecycle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!