getSupportFragmentManager() is undefined

后端 未结 8 1272
生来不讨喜
生来不讨喜 2020-12-29 00:50

I\'m getting the following error: \"The method getSupportFragmentManager() is undefined for the type new View.OnClickListener(){}\" in my fragment

8条回答
  •  臣服心动
    2020-12-29 01:29

    I did a diff on Marco's answer to see what he actually recommended changing: just

    d.show(getSupportFragmentManager(), "dialog");
    

    to

    FragmentManager fm = 
        ObstetricsFragment1.this.getSherlockActivity().getSupportFragmentManager();
    d.show(fm, "dialog");
    

提交回复
热议问题