onCreateView dialogfragment : So i created an fragment and there's a button inside it when clicked it pop an dialogfragment, so my problem is it crashed when i run it

    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {


        final View view = inflater.inflate(R.layout.fragment_one, container, false);
        Button off = (Button) getActivity().findViewById(R.id.btnOff);

        off.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v)
            {
                OneFragment.this.onOff(View v);//error here
            }
        });
        return view;
    }

    public void onOff(View v){
        new OffButton().show(getFragmentManager(),"off");
    }