我对android中不兼容的片段有问题
问题在于片段中的不兼容类型。请查查,我不知道该怎么办 代码如下:我对android中不兼容的片段有问题,android,android-fragments,fragment,Android,Android Fragments,Fragment,问题在于片段中的不兼容类型。请查查,我不知道该怎么办 代码如下: case R.id.mwelcome: currentFragment = new WelcomeFragment(); // the problem is here incompatible types break; currentFragment = new MapFragment(); // the problem
case R.id.mwelcome:
currentFragment = new WelcomeFragment(); // the problem is here incompatible types
break;
currentFragment = new MapFragment(); // the problem is here incompatible types
case R.id.map:
break;
这个问题是不相容的。Android中有两个可用的片段类: android.app.Fragment android.support.v4.app.Fragment 由于您实际上没有提供太多代码,我只能猜测,但我相当确定您的currentFragment变量是这些片段类型之一,而您的WelcomeFragment和MapFragment对象是另一种类型
确保您在所有内容中都使用了android.support.v4.app.Fragment,因为android.app.Fragment已被弃用。检查您的导入并在需要时进行修复。哇,您太棒了,jajaj对不起,我的英语很差xD Jajajaj。但是非常感谢你,朋友:。你告诉我的有用xD:。