Skip to content

Tag: kotlin

How rewrite Java generec’s into Kotlin?

I have java class and I need to rewrite it in kotlin. But I can’t rewrite generics into it. Java class: My Kotlin class Sign (1) I marked the my problem area by my opinion. But maybe the problem is somewhere else. Answer Kotlin’s <out FlagFilter> is not equivalent to Java’s <T exten…

How to set the width and height of a layout in Android?

I have this ConstraintLayout: lateinit var myConstraintLayout: ConstraintLayout I try to set its width and height to match its parent via code, like this: But I get error androidx.constraintlayout.widget.ConstraintLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams Why? How do I fix …

How to parse this date/time in Java/Kotlin?

I have this NMEA timestamp: 120722202122 and I want to parse it. I tried Playground but I get an Exception: I don’t know what the Exception wants to tell me or what my pattern should look like. Answer I assume you’ve probably meant the day of the month d, not the day of the year D. In your pattern…

How to remove underline in hyperlink

I have a TextView on my ‘settings’ activity: I have defined my URL on the string. On my settings.kt page I have the following code onCreate: From what I have found, I need to add a ‘spannable’ in relation to the above (settings.kt) but I’m not sure how to apply it, as everyone ad…

Korge gradle setup for JVM target

I want to try the Korge libs on the JVM. I used the Korge IntelliJ plugin to create a new project. My build.gradle.kts looks like this : I’ve copied the commonMain code into the jvmMain folder and running the project with the runJvm command. I’ve looked into the examples on the korge doc and githu…