我遵循了 android 示例,但我有一个不全面的错误:
void showDialog() {
DialogFragment newFragment = MyAlertDialogFragment.newInstance();
newFragment.show(fm, "alert");
}
public static class MyAlertDialogFragment extends DialogFragment {
public static MyAlertDialogFragment newInstance() {
MyAlertDialogFragment frag = new MyAlertDialogFragment();
return frag;
}
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()).setTitle("test")
.setMessage("bla bla bla").create();
}
}
newFragment.show(fm, "alert");
给我一个错误:
DialogFragment 类型中的方法 show(FragmentManager, String) 不适用于参数 (FragmentManager, String)
有人可以帮助我吗?