[英]App crashes when changing into light to dark mode
In my main activity I'm attaching two fragments and using tablayout.在我的主要活动中,我附加了两个片段并使用了 tablayout。 Whenever I change light to dark or dark to light, I'm getting this error 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
and the error is showing in the onCreate()
of super.onCreate(savedInstanceState)
main activity.并且错误显示在
super.onCreate(savedInstanceState)
主要活动的onCreate()
中。
Unable to instantiate fragment com.umobi.scantags.fragments.DeactiveFragment: could not find Fragment constructor
无法实例化片段 com.umobi.scantags.fragments.DeactiveFragment:找不到片段构造函数
Your DeactiveFragment
needs a zero-argument constructor, or alternatively you need to register a FragmentFactory
that instantiates the fragment without a zero-arg constructor.您的
DeactiveFragment
需要一个零参数构造函数,或者您需要注册一个FragmentFactory
来实例化片段而无需零参数构造函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.