【发布时间】:2021-06-22 02:15:24
【问题描述】:
在我的主要活动中,我附加了两个片段并使用了 tablayout。每当我将浅色改为深色或深色改为浅色时,我都会收到此错误enter image description here
Process: com.umobi.scantags, PID: 24666
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.umobi.scantags/com.umobi.scantags.activities.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.umobi.scantags.fragments.DeactiveFragment: could not find Fragment constructor
错误显示在 onCreate() 的 super.onCreate(savedInstanceState) 主活动中。
【问题讨论】:
-
尝试在 Fragments 中添加一个空的构造函数!
标签: android android-studio kotlin android-fragments oncreate