Skip to content
Advertisement

Tag: kotlin

supportFragmentManager.commit in kotlin is not working

Can anyone help me with this please? Inside my fragment supportFragmentManager.commit{} is not working. Android Studio is not recognizing this I don’t know what to do. I am working in kotlin project Answer That commit {} method (with the transaction in a lambda) is an extension function provided by the Fragment KTX library. If you haven’t already, you need to

Overload resolution ambiguity in third party java library called from kotlin

I wrote a small program in Kotlin which uses library https://github.com/KaptainWutax/SeedUtils, specifically the Dimension enum https://github.com/KaptainWutax/SeedUtils/blob/master/src/main/java/kaptainwutax/seedutils/mc/Dimension.java When I call e.g. Dimension.OVERWORLD.name, I get Overload resolution ambiguity. I know what is the issue, the problem is that enum Dimension has name field, and the enum class itself has name field https://kotlinlang.org/docs/reference/enum-classes.html The question is, what can I do about it. My

how to get channel’s data list from Telegram by TDLib?

Telegram, I need to get channel’s data list. I use for this case TdApi. Documentation: https://javadoc.tlgrm.ru/org/drinkless/td/libcore/telegram/TdApi.html I do it based on this example: https://core.telegram.org/tdlib/tdlib.zip. I still got chat’s list by this example. Check here my way: I tried to modificate this by adding classe from documentation. Channel, ChannelFull GetChannelFull. I added GetChannelFull into Function class. In the issue I filter

How is Kotlin able to call Java 11 code using JDK 1.8?

I was playing around with a Kotlin project which has some Java 11 calls and noticed that it seems to build and run fine using Java 8. The call in particular is to java.lang.String#isBlank(), which was introduced in Java 11. I’m using Gradle to build and run tests. Build JDK is set to JDK 1.8 and Kotlin compile target is

How to prevent activity to restart after changing its orientation

I’m new to android development using KOTLIN, i have activity that contain fragments like the image below (Image 1), the problem is whenever i try to change the orientation from potrait to landscape, the activity return to the previous activity (Like restart it). I’ve tried to add android:configChanges=”orientation|screenSize|keyboardHidden” to my AndroidManifest.xml, it works perfectly but some says that it’s not

Why Kotlin/Java doesn’t have an option for preemptive scheduler?

Heavy CPU bound task could block the thread and delay other tasks waiting execution. That’s because JVM can’t interrupt running thread and require help from programmer and manual interruption. So writing CPU bound tasks in Java/Kotlin requires manual intervention to make things run smoothly, like using Sequence in Kotlin in code below. As far as I understood the reason is

Advertisement