var list:ArrayList<ProfilePost> = ArrayList()
GlobalScope.launch {
list= apiInterface.GetVideosByUser(ApiInterface.PublicationRequestBodyGet(id.toString()))
.await().publications
}
runOnMainThread {
adapter = ProfilePostAdapter(list, "mine")
recylcerPost.adapter = adapter
recylcerPost.layoutManager = GridLayoutManager(context, 3)
}
In this code I can't get the value of the publications in list variable so list stays null. And I need to separate the creation of the recycler view from the GetVideosByUser function because it freezes my screen