Skip to content

Instantly share code, notes, and snippets.

@leeyc09
Created January 26, 2016 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leeyc09/7214045875fc31021f76 to your computer and use it in GitHub Desktop.
Save leeyc09/7214045875fc31021f76 to your computer and use it in GitHub Desktop.
Call<JsonObject> jsonObjectCall = sample_RestfulAdapter.getInstance().Project();
jsonObjectCall.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(Response<JsonObject> response) {
//통신성공 시
JsonObject jsonObject = response.body();
//Json 파싱 후 사용
}
@Override
public void onFailure(Throwable t) {
//통신 실패 시
}
});
//use beans
Call<AuthModel> AuthObjectCall = sample_RestfulAdapter.getInstance().Auth();
AuthObjectCall.enqueue(new Callback<AuthModel>() {
@Override
public void onResponse(Response<AuthModel> response) {
AuthModel authModel = response.body();
authModel.getEmail();
}
@Override
public void onFailure(Throwable t) {
}
});
//use Rxandroid with Lambda
df_RestfulAdapter.getInstance().Project()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(jsonObject -> {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment