标签:www ack fail callback ble client public exception set
/* // final Request request = new Request.Builder().url("https://localhost:8080/zb.json").build();//这个地址拿不到数据
final Request request = new Request.Builder().url("http://202.192.134.11:8080/zb.json").build();
// final Request request = new Request.Builder().url("https://www.baidu.com").build();
OkHttpClient client = new OkHttpClient();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.e("TAG","okhttp获取数据失败");
}
*//**
* 此时还在非UI线程中
* @param call
* @param response
* @throws IOException
*//*
@Override
public void onResponse(Call call, Response response) throws IOException {
final String res = response.body().string();
Log.e("TAG",res);
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.e("TAG", res);
Log.e("TAG", "倪伟金");
version_textView.setText(res);
}
});
}
});
*/
标签:www ack fail callback ble client public exception set
原文地址:http://www.cnblogs.com/princenwj/p/6106826.html