Slide 57
Slide 57 text
new OkHttpClient().newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, final Response response)
throws IOException {
final String body = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this, body,
Toast.LENGTH_LONG).show();
}
});
}
});
• enqueue ʹ Callback Λ͢ͱ
ผεϨουͰ Request ͞ΕΔ