Questions tagged [android-ktx]

Android KTX is an open source set of Kotlin Extensions which aims to make Kotlin code more simple and clean when developing for the Android Platform. DO NOT use this tag in questions about the Android Kotlin Extensions plugin.

Android KTX is a library developed by Google that simplifies the way Android Apps are written with Kotlin. It is still in preview and may change anytime.

Resources

45 questions
3
votes
1 answer

Why is my default alert dialog button text white?

I have set up my app as follows: build.gradle implementation 'com.google.android.material:material:1.1.0' styles.xml it's working fine, but I…
1
vote
2 answers

When to use emit() instead of postValue when using livedata with coroutines

I need to get a liveData from the return value of a suspend function. For this - I can launch a coroutine (using for eg viewmodelScope) and use postValue to update a MutableLiveData instance. val apiLiveData = MutableLiveData() fun…
1
vote
1 answer

Android KTX: how to override Kotlin added property extension

I am trying to override View.setRotation() method in Kotlin. Since AndroidKTX already provided property extension "rotation", caller's can simply call viewObject.rotation = 90.0f to rotate the view. However, I want to add some additional operation…
Robin
  • 10,052
  • 6
  • 31
  • 52
1
vote
1 answer

Can I instantiate a user object directly using MutableLiveData in Kotlin?

The Text A and Code A are from this article . I'm very strange why they don't use Code B or Code C to instantiate the user object. I think Code B and Code C are very simple and clear. BTW, I havn't test Code B and Code C, but I think that they are…
HelloCW
  • 843
  • 22
  • 125
  • 310