https://kotlinlang.org
Join Slack
Can we use lottie animations in compose KMM.
f

Farhazul Mullick

almost 2 years ago
Can we use lottie animations in compose KMM.
f
h
a
  • 3
  • 4
  • 1189
How to deal with a route in `NavHost` that contains polymorphic members … more in :thread:
a

Ahmed

about 1 year ago
How to deal with a route in
NavHost
that contains polymorphic members … more in 🧵
a
s
  • 2
  • 10
  • 1188
Hello, I get this error. What is the reason? " error: @Binds methods' parameter type must be assign...
h

Hovhannes

about 4 years ago
Hello, I get this error. What is the reason? " error: @Binds methods' parameter type must be assignable to the return type public abstract com.example.data.network.AuthApi " in AppModule
@Module
@InstallIn(SingletonComponent::class)
abstract class AppModule {


    companion object {
        @Singleton
        @Provides
        fun provideRemoteDataSource(): RemoteDataSource {
            return RemoteDataSource()
        }



        @Singleton
        @Provides
        fun provideUserApi(
            remoteDataSource: RemoteDataSource,
      
        ): UserApi {
            return remoteDataSource.buildTokenApi()
        }

        @Provides
        fun provideAuthRepository(authApi: AuthApi): AuthRepository {
            return AuthRepository(authApi)
        }


        @Provides
        fun provideUserRepository(userApi: UserApi): UserRepository {
            return UserRepository(userApi)
        }
    }



        @Binds
        @Singleton
        abstract fun bindsRemoteDataSource(authRepository: AuthRepository): AuthApi
}
class AuthRepository @Inject constructor(private val api: AuthApi) : BaseRepository(api) {....}
h
a
  • 2
  • 8
  • 1188
I want to extract the array data from the json response and store the data in my custom data class. ...
t

T

over 5 years ago
I want to extract the array data from the json response and store the data in my custom data class.
data class NewsData (

    val author: String, val title: String,
    val url: String, val publishedAt: String
)
class NewsViewModel : ViewModel() {

    // The internal MutableLiveData String that stores the most recent response
    private val _response = MutableLiveData<String>()

    // The external immutable LiveData for the response String
    val response: LiveData<String>
        get() = _response

    /**
     * Call getNewsData() on init so we can display status immediately.
     */
    init {
        getNewsData()
    }

    /**
     * Sets the value of the status LiveData to the News API status.
     */
    private fun getNewsData() {

        _response.value = NewsApi.retrofitService.getProperties().enqueue(
            object : Callback<ResponseBody> {
                override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
                    _response.value = "Failure: " + t.message
                    //Log.i("response", t.message)
                }

                override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
                    val root = JSONObject(response.body().toString())
                    val jsonArr = root.getJSONArray("articles")
                    val ob = jsonArr.getJSONObject(0)
                    val name = ob.getString("author")
                    _response.value = name
                }
            }).toString()
    }
}
This is the format of the json response.
t
o
  • 2
  • 19
  • 1188
If I convert a `Color` value to `Int` (using `toArgb()`) so I can save it in Datastore, how would I ...
n

Nat Strangerweather

over 3 years ago
If I convert a
Color
value to
Int
(using
toArgb()
) so I can save it in Datastore, how would I then convert the
Int
back to Jetpack Compose
Color
?
n
s
+2
  • 4
  • 7
  • 1187
Hi everyone, I want to migrate to Kotlin `1.9.0` from `1.8.22` . It all works well on my machine but...
d

dawidhyzy

over 2 years ago
Hi everyone, I want to migrate to Kotlin
1.9.0
from
1.8.22
. It all works well on my machine but fails during a build on CI with:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinStoreYarnLock'.
> yarn.lock was changed. Run the `kotlinUpgradeYarnLock` task to actualize yarn.lock file
I tried running
kotlinUpgradeYarnLock
on my machine but there is no change to yarn lock.
d
h
+3
  • 5
  • 25
  • 1183
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g

Gaurav Tyagi

about 3 years ago
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g
a
  • 2
  • 4
  • 1182
Is there a notion of priority with coroutines? I'd like to do some job in background but I'd like it...
d

dekans

over 7 years ago
Is there a notion of priority with coroutines? I'd like to do some job in background but I'd like it to be executed ASAP, before other queued & less important jobs
d
p
+3
  • 5
  • 31
  • 1182
How can I call child composable function in parent composable function?
c

chanjungskim

over 2 years ago
How can I call child composable function in parent composable function?
c
p
  • 2
  • 10
  • 1181
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios <@...
s

Shivam Kanodia

over 2 years ago
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios @etolstoy?
s
n
+2
  • 4
  • 5
  • 1178
Previous313233Next

kotlinlang

A modern programming language that makes developers happier.

Powered by