pzy64X

GET-KOTLIN

Sep 28th, 2018
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. val client = OkHttpClient()
  2. val request = Request.Builder()
  3. .url("http://192.168.100.70:3000/amigosApi/grp/category/group/$id")
  4. .build()
  5. val response = client.newCall(request).execute()
  6.  
  7. response.body()?.let {
  8. val data = Gson().fromJson(it.string(), Array<GroupData>::class.java)
  9. Log.d("xtx", data.size.toString())
  10. uiThread {
  11. if (data.isNotEmpty())
  12. recyclerView.adapter = GroupAdaptor(data, this@GroupActivity)
  13. else {
  14. Toast.makeText(this@GroupActivity, "No data found", Toast.LENGTH_SHORT).show()
  15. }
  16. refreshLayout.isRefreshing = false
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment