简体   繁体   English

切换到浅色模式时应用程序崩溃

[英]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.

相关问题 更改为浅色模式时,React Native App 崩溃 - React native App crashes when changing into light to dark mode 动态更改为暗/亮模式时闪烁 - Flash when changing to dark/light mode dynamically 暗/亮模式重新创建应用程序后,SwitchCompats 检查不正确 - SwitchCompats are checked incorrectly after Dark/Light Mode recreates the app 深色工具栏上的灯光操作模式 - Light action mode on dark toolbar 如何根据一天中的时间在暗模式和亮模式之间切换应用程序? - How to change app between dark mode and light mode depending on the time of day? 带有Light App主题的深色工具栏 - Dark Toolbar with Light App Theme 当我从亮模式切换到暗模式时出现此错误 - I get this error when I switch from light mode to dark mode 除非在 Flutter 中重新打开应用程序,否则在设置中将主题从浅色更改为深色不会反映在应用程序中 - Changing the theme from light to dark in the settings does not reflecting in the app unless the app is reopened in Flutter 暗模式:useColorScheme() 在 Android 上总是返回光 - Dark Mode: useColorScheme() always returns light on Android 复选框在明暗模式下呈现不同 - Checkboxes render differently in light and dark mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM