小编Aet*_*ooc的帖子

Kotlin 检查变量是否在两个数字之间

我有来自 LocalTime.now() 的当前时间。我想使用当前时间来检查两个双数之间是否存在但我无法将时间转换为双数

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    val CurrentTime = LocalTime.now().format(DateTimeFormatter.ofPattern("HH.mm"))

    tvDetailIcon = view.findViewById(R.id.tvDetailIcon)
    testTime = view.findViewById(R.id.testTime)
    testTime.text = CurrentTime


    if (24.00<testTime && testTime<25.00 ){
        constraint.setBackgroundColor(Color.parseColor("#34495e"))
        tvDetailIcon.setImageResource(R.drawable.ic_baseline_nights_stay_24)
    }

    else if (1.00<testTime && testTime<24.00){
        constraint.setBackgroundColor(Color.parseColor("#349Bdb"))
        tvDetailIcon.setImageResource(R.drawable.ic_baseline_wb_sunny_72)

    }
Run Code Online (Sandbox Code Playgroud)

你可以在这里找到失败。

android kotlin

8
推荐指数
2
解决办法
1万
查看次数

在握手之前收到一个意外的数据包。- 安卓工作室

当我Flutter在 上运行项目时Android Studio,在模拟器上运行应用程序之前,事件日志会显示"An unexpected packet was received before the handshake"tsixseven。之后应用程序就可以在模拟器上正常运行了。
但是当我在 上运行相同的项目时VS Code,它工作得很好。

注意:我也在JavaAndroid Studio 上制作应用程序,但从未显示此错误。

mobile-application android-studio flutter

8
推荐指数
1
解决办法
6504
查看次数