我运行我的应用程序,然后崩溃,如下所示。
我不知道会发生什么。
无法实例化片段pl.wm.coreguide.fragments.FragmentCalendar:确保类名存在,是公共的,并且具有公共的空构造函数
这是我第一次崩溃应用程序。
你能看一下我的代码吗?
public class FragmentCalendar extends ListFragment {
ArrayList<String []> events;
ArrayAdapter<String []> adapter;
private Class<?> classToStartOnCLick;
private int listView = -1;
public FragmentCalendar(Class<?> classToStartOnCLick,int listView) {
this.classToStartOnCLick = classToStartOnCLick;
this.listView = listView;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DatabaseControlReadOnly db = new DatabaseControlReadOnly(getActivity());
events=db.getAllEvents();
adapter = new ListAdapter(getActivity(),events);
setListAdapter(adapter);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if(listView != -1) return inflater.inflate(listView, container, false);
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
答案 0 :(得分:0)
是的......我相信其他人已将其置于评论中,但实际上只是缺少这一点:
public FragmentCalendar() {}