Unable to instantiate Fragment

后端 未结 12 2052
无人及你
无人及你 2020-12-24 06:42

Unable to instantiate fragment make sure class name exists, is public, and has an empty constructor that is public

Is it because my Fr

12条回答
  •  礼貌的吻别
    2020-12-24 07:28

    public static class MyDialogFragment extends DialogFragment {
    
        public MyDialogFragment(){
    
        }
    
        public Dialog onCreateDialog(Bundle savedInstanceState) {
                LinearLayout main = new LinearLayout(getActivity());
        main.setOrientation(LinearLayout.VERTICAL);
    
    
                return (new AlertDialog.Builder(getActivity()).setTitle(
        getText("Title")).setView(main).create());
                }
     }
    

提交回复
热议问题