You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
667 B
35 lines
667 B
package com.github.catvod.net;
|
|
|
|
import java.io.IOException;
|
|
|
|
import okhttp3.Call;
|
|
import okhttp3.Response;
|
|
|
|
public class CallBack {
|
|
|
|
private String result;
|
|
|
|
public String getResult() {
|
|
return result;
|
|
}
|
|
|
|
public void setResult(String val) {
|
|
result = val;
|
|
}
|
|
|
|
public void onSuccess(Call call, Response response) {
|
|
setResult(onParseResponse(call, response));
|
|
}
|
|
|
|
public void onError() {
|
|
setResult("");
|
|
}
|
|
|
|
public String onParseResponse(Call call, Response response) {
|
|
try {
|
|
return response.body().string();
|
|
} catch (IOException e) {
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
|