我跟隨機器人的例子,但我有一個不全面的錯誤:問題與alertdialog秀片段的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");
返回我一個錯誤:
的方法秀(FragmentManager,字符串)在類型DialogFragment是 不適用於參數(FragmentManager,String)
某人c應該幫助我嗎?