reymesson1 / septimoejercicio-android

0 stars 0 forks source link

Modal should show the inventary list items #16

Open reymesson1 opened 5 years ago

reymesson1 commented 5 years ago

val stringList = ArrayList()

reymesson1 commented 5 years ago

fun getDataList() : ArrayList{

    var detailService : DetailService = rest.getDetail()

    var call = detailService.getDetail()

    val stringList = ArrayList<String>()

    call.enqueue(object : Callback<List<Detail>>{
        override fun onFailure(call: Call<List<Detail>>, t: Throwable) {
            Log.i("error", t.toString())
        }

        override fun onResponse(call: Call<List<Detail>>, response: Response<List<Detail>>) {

            response.body()!!.forEach {

                stringList.add(it.name)
            }

        }

    })

    return stringList
}