Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Kotlin超类型列表中只能出现一个类_Android_Kotlin - Fatal编程技术网

Android Kotlin超类型列表中只能出现一个类

Android Kotlin超类型列表中只能出现一个类,android,kotlin,Android,Kotlin,我遇到了两个超级类的麻烦。添加PreferenceFragment()时,我收到一个错误:超类型列表中只能出现一个类 关于我如何解决这个问题有什么想法吗 class MyAccountFragment @Inject constructor(): BaseFragment(), PreferenceFragment() { override fun onCreate(savedInstanceState: Bundle?) { TODO("not implemented

我遇到了两个超级类的麻烦。添加PreferenceFragment()时,我收到一个错误:超类型列表中只能出现一个类

关于我如何解决这个问题有什么想法吗

class MyAccountFragment @Inject constructor(): BaseFragment(), PreferenceFragment() {

    override fun onCreate(savedInstanceState: Bundle?) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun initView() {
    }

    override fun initEvent() {
    }
}

谢谢

我找到了一个解决方案。

基本片段和首选片段都是从片段扩展而来的,因此MyFragment必须选择一个从中继承。发布你的基本片段的外观,然后我们可以在基础中使用DaggerFragment进行拨号,所以我注意到你在MyFragment上有一个@Inject注释。您是否在项目中使用FragmentFactory api?如果需要其他专用片段,请不要使用daggerfragment。使用可选的HasAndroidJector接口