每当我按下按钮时,我都会尝试解析包含 JSON 的 url:
button.setOnClickListener { doAsync{ val result = URL("http://date.jsontest.com/").readText() val parser: Parser = Parser() val stringBuilder: StringBuilder = StringBuilder(result) val json: JsonObject = parser.parse(stringBuilder) as JsonObject val time = "Time : ${json.string("time")}" uiThread { textView.setText(time) }}}
但我收到一个错误:
修剪批准的打印服务时出错。java.util.concurrent.TimeoutException:无法获取后台处理程序!
怎么了 ?