小编Pau*_*sev的帖子

androidx.activity.ComponentActivity 的超类 androidx.core.app.f 被声明为最终类

我想更新 Play 商店中应用程序的版本,但在测试中我开始收到此错误。

Superclass androidx.core.app.f of androidx.activity.ComponentActivity is declared final
Run Code Online (Sandbox Code Playgroud)

根据谷歌问题跟踪器,这是新的,也许有人有解决这个问题的方法。

testing android google-play

29
推荐指数
2
解决办法
2400
查看次数

如何创建扩展函数ifNullOrEmpty?

我想创建一个类似 Kotlin 的 ifEmpty() 的函数,它也会检查 null:

ifNullOrEmpty{
  //some code if null or empty
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

有谁知道下面的代码叫什么?

: R where C : CharSequence, C : R
Run Code Online (Sandbox Code Playgroud)

Kotlin ifEmpty() 函数的示例。

@SinceKotlin("1.3")
@kotlin.internal.InlineOnly
public inline fun <C, R> C.ifEmpty(defaultValue: () -> R): R where C : CharSequence, C : R =
    if (isEmpty()) defaultValue() else this
Run Code Online (Sandbox Code Playgroud)

感谢,并有一个愉快的一天!

extension-methods kotlin

6
推荐指数
1
解决办法
491
查看次数