emedinaa / kotlin-mvvm

MVVM(Model View ViewModel) sample in Kotlin using the components ViewModel, LiveData and Retrofit library
531 stars 118 forks source link

How is it done if the Json is an array? #6

Open Rafelcf opened 3 years ago

Rafelcf commented 3 years ago

I would like to know how the MainActivity and the ViewModel are made, if the Json is an array? Thank you

emedinaa commented 2 years ago

hi @Rafelcf , thanks for your comment. If you receive an array, just you need to change on the retrofit interface

https://github.com/emedinaa/kotlin-mvvm/blob/master/KotlinMVVM/app/src/main/java/com/emedinaa/kotlinmvvm/data/ApiClient.kt

for example : interface ServicesApiInterface { @GET("/api/museums/") fun museums(): Call<List<Museum>> }

Rafelcf commented 2 years ago
  Perfect thanks De: Eduardo José Medina AlfaroEnviado: lunes, 18 de octubre de 2021 18:53Para: emedinaa/kotlin-mvvmCC: RafelCf; MentionAsunto: Re: [emedinaa/kotlin-mvvm] How is it done if the Json is an array? (#6) hi @Rafelcf , thanks for your comment. If you receive an array, just you need to change on the retrofit interfacehttps://github.com/emedinaa/kotlin-mvvm/blob/master/KotlinMVVM/app/src/main/java/com/emedinaa/kotlinmvvm/data/ApiClient.ktfor example :interface ServicesApiInterface { @GET("/api/museums/") fun museums(): Call> }—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.