最佳答案
我正在用 Fragments
创建一个应用程序,在其中一个应用程序中,我创建了一个非默认构造函数,并得到了以下警告:
Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead
有人能告诉我为什么这不是个好主意吗?
你还能建议我怎么做吗:
public static class MenuFragment extends ListFragment {
public ListView listView1;
Categories category;
//this is my "non-default" constructor
public MenuFragment(Categories category){
this.category = category;
}....
不使用非默认构造函数?