【发布时间】:2013-10-15 06:34:51
【问题描述】:
我有这样的课:
class TopicFragment extends Fragment{
public TopicFragment(VO vO) {
// some code
}
}
用户报告应用程序崩溃并且日志显示:
android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.aaa.wert.TopicFragment: make sure class name exists, is public, and has an empty constructor that is public
我已经查看了这个链接,但我无法解决这个问题;
Do fragments really need an empty constructor?
Fragment - InstantiationException: no empty Constructor -> Google Maps v2?
请帮帮我。
【问题讨论】:
-
您也应该发布实例化此片段的代码。还有,为什么 TopicFragment 本身不公开?
-
好吧,首先,改变你的片段构造函数,让它为空,也没有参数。然后将 TopicFragment 设置为 public。然后,请发布您的完整代码。
标签: android android-fragments fragment