How to implement OnFragmentInteractionListener

后端 未结 12 2510
花落未央
花落未央 2020-11-22 06:25

I have a wizard generated app with navigation drawer in android studio 0.8.2

I have created a fragment and added it with newInstance() and I get this error:

12条回答
  •  长情又很酷
    2020-11-22 07:03

    I'd like to add the destruction of the listener when the fragment is detached from the activity or destroyed.

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }
    

    and when using the new onStart() method with Context

    @Override
    public void onDestroy() {
        super.onDestroy();
        mListener = null;
    }
    

提交回复
热议问题