Home > Mobile >  conver JSON Object to ListOf in Kotlin
conver JSON Object to ListOf in Kotlin

Time:12-21

Hello everyone I want to convert JSON API to ListOf Kotlin how I can convert? I am using the Volley library this is JSON API https://jsonplaceholder.typicode.com/todos

List Should be like =>

                        val imagesList = listOf(
                        R.drawable.designer,
                        R.drawable.image,
                        R.drawable.image,
                        R.drawable.designer,
                        R.drawable.image,
                        R.drawable.image,
                        R.drawable.designer,
                        R.drawable.image,
                        R.drawable.image,
                        R.drawable.designer,
                        R.drawable.image,
                        R.drawable.image,
                        R.drawable.designer,
                        R.drawable.image,
                    )

CodePudding user response:

Am, what? You have to use a structure "data class" to convert JSON to Kotlin, but R.drawable.image - it's Int object (drawable ID constantly changes as new files are added). You will be destoy your app after first change a folder "Resourses". Store pictures on the server

  • Related