【发布时间】:2016-01-09 05:36:01
【问题描述】:
查看DialogFragment 的documentation,可以看到用于初始化新警报对话框片段的静态newInstance 方法。我的问题是,为什么不使用构造函数来这样做,像这样:
public MyAlertDialogFragment(int title) {
Bundle args = new Bundle();
args.putInt("title", title);
setArguments(args);
}
这不是完全一样还是有什么不同?最好的方法是什么?为什么?
【问题讨论】:
标签: android constructor android-dialogfragment