The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the,

来源:互联网 发布:猎奇网源码 编辑:程序博客网 时间:2024/05/02 06:45

The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)


今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题  import android.app.Fragment;
import android.app.FragmentManager;   其实我应该使用的是  import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;   然后自己查看了一下API二者差别还是蛮大的   import android.app.Fragment 只能在API版本大于11的时候使用   而不包含getFragmentManager() 和 getSupportFragmentManager()  两个方法的   虽然在代码这样写不会报错的  但是  replace(int, Fragment, String)执行的时候会一直出现错误   提示上面那个错误信息

0 0