kotlin 相关问题

Kotlin是一种由JetBrains支持的开源,静态类型编程语言。 Kotlin结合了OO和功能特性,专注于互操作性,安全性,清晰度和工具支持。它目前面向JVM和JavaScript,它是Android上官方支持的语言。






findnavController()。从片段中的组合导航导致异常

I有一个正常的片段子类,该子类曾经是基于视图和使用的视图。我正在迁移以缓慢撰写,因此我基本上删除了与视图相关的代码,现在使用onCreateview ...

回答 1 投票 0

如何从健康连接过滤手动步骤计数

suspend fun getTodayTotalSteps(healthConnectClient: HealthConnectClient): Long { Timber.d("counting_to") val now = LocalDateTime.now().with(LocalTime.MAX) val startOfDay = now.toLocalDate().atStartOfDay() var totalSteps = 0L try { Timber.d("start_time:::$startOfDay") Timber.d("end_time:::$now") val response = healthConnectClient.readRecords( ReadRecordsRequest( StepsRecord::class, timeRangeFilter = TimeRangeFilter.between(startOfDay, now) ) ) for (record in response.records) { if (record.metadata.recordingMethod == RECORDING_METHOD_AUTOMATICALLY_RECORDED) { totalSteps += record.count } Timber.d("total_steps_after_Wallet_creation:::$totalSteps") } return totalSteps } catch (e: Exception) { // Run error handling here Timber.d("error in getting steps today $e") } return totalSteps }

回答 0 投票 0


kotlin“破坏类型的声明初始化器,必须具有'component1()'函数...”

我有每个循环 for(连接中的conn){ var(第一,第二,第三)= reader.getLatency(conn,locationAssignment) } 读者在哪里 打开类延迟阅读器{ 伴侣objec ...

回答 1 投票 0

我想让我的应用程序能够通过按钮调用特定号码,但是我发现的所有解决方案都适用于java,而不是kotlin,而我的应用在kotlin

我希望能够使用我的应用程序中的按钮调用特定的预设号码,这是我的代码 val button3 =findViewById(r.id.button3) 我希望能够使用我的应用程序中的按钮调用特定的预设号码,这是我的代码,但是当我运行应用程序时,按钮可以做任何事情 val button3 = findViewById<Button>(R.id.button3) button3.setOnClickListener { val number = "*#0*#" val intent = Intent(Intent.ACTION_DIAL) intent.setData(Uri.parse("tel:" + "*#0*#")) startActivity(intent) } 我也列出了许可 \<uses-permission android:name="android.permission.CALL_PHONE"/\> 清单中 我能发现的所有论坛在线上都没有工作 try这个 button3.setOnClickListener { val phoneNumber = "*#0*#" val intent = Intent(Intent.ACTION_DIAL).apply { data = Uri.parse("tel:$phoneNumber") } if (intent.resolveActivity(packageManager) != null) { startActivity(intent) } }

回答 1 投票 0

我如何编写单元测试,以确保功能失败并在成功之前进行几次重试? 我的功能看起来像这样: 有趣的runworkflow(数据:Promise

fun runWorkflow(data: Promise<Data>) { withRetries(data, data.get().timeout) { runAction(it.get(), client) } }

回答 0 投票 0



我如何从自定义键盘发送WhatsApp中的动画贴纸

因此,我构建了一个具有自定义键盘的应用程序,我可以在其中用于共享贴纸,我可以轻松地发送非动画贴纸,但是当它到达动画贴纸时,它不是,因为从whastapp

回答 1 投票 0




无法解决Kotlin MultiplAtform中导入的Cinterop iOS

I遵循Kotlin文档以添加iOS依赖性。 就我而言,依赖性是通过第三方提供的预编译框架。 所以我遵循了框架进行框架

回答 3 投票 0

我如何在Geckoview

我想在geckoview中安装firefox扩展 我尝试了Docu()的指令。 我的代码: val runtime = geckoruntime.create(this) geckosession.open(运行时) geckoview.setsession(

回答 1 投票 0

使用org.springframework.security设置基于OAUTH的身份验证/授权的正确方法:Spring-Security-Messaging

从我开始使用OAuth成功身份验证的项目开始... 春天: 安全: oauth2: 资源服务器: JWT: 发行人-URI:... 观众: ...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.