错误片段应该提供默认构造函数

时间:2017-06-08 19:20:51

标签: android

我有GamePlayFragment.java错误,通知"片段应提供默认构造函数"

这是我的GamePlayFragment扩展片段



    public GamePlayFragment(Context context, Handler handler, int musicVolume, int soundVolume, SharedPreferences preferencesSaveGamePlay) {
        this.context = context;
        this.handler = handler;
        this.musicVolume = musicVolume;
        this.soundVolume = soundVolume;
        this.preferencesSaveGamePlay = preferencesSaveGamePlay;
        layoutInflate = layoutInflate.from(context);
        view = layoutInflate.inflate(R.layout.gameplay_layout, null);
        initFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return view;
    }


    private void initFragment() {
        layoutGamePlay = (FrameLayout) view.findViewById(R.id.myFrame);
        gamePlay = new GamePlay(context, layoutGamePlay, handler, soundVolume,
                musicVolume, preferencesSaveGamePlay);
        layoutGamePlay.addView(gamePlay);
        loadGameData();
    }




如何删除该错误?

感谢

0 个答案:

没有答案