logo
summer

太阳当空照,花儿对我笑。

OkHttp3

10/21/2022, 1:35:09 PM
  1. 首页
  2. /
  3. 正文
implementation("com.squareup.okhttp3:okhttp:4.10.0")
val request = Request.Builder()
				.url("https://api.galasp.cn/configs/list")
				.build()
			OkHttpClient().newCall(request)
				.enqueue(object : Callback {
					override fun onFailure(call: Call, e: IOException) {
					}

					override fun onResponse(call: Call, response: Response) {
						val body = response.body?.string().toString()
						println(body)
						val items = JSONArray(body)
						for (i in 0 until items.length()) {
							println(items[i])
						}
					}
				})
热门文章
标签云
© 2021 Copyright 本站由 upyun 提供储存服务