use of com.example.user.dvectn.POJO.POJO_PJ_P6 in project DVECTN by tanaponudom.
the class NetworkConnectionManager method callServer_pj_p6.
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void callServer_pj_p6(final OnNetworkCallback_PJ_P6 listener, int member_id, int ex61, int ex62, int ex63, int ex64, int ex65, int ex66) {
Gson gson = new GsonBuilder().setLenient().create();
final Retrofit retrofit = new Retrofit.Builder().baseUrl(Fragment_login.BASE_URL).addConverterFactory(GsonConverterFactory.create(gson)).build();
APISERVER callapi = retrofit.create(APISERVER.class);
Call call = callapi.getDataPJP6(member_id, ex61, ex62, ex63, ex64, ex65, ex66);
call.enqueue(new Callback<POJO_PJ_P6>() {
@Override
public void onResponse(Call<POJO_PJ_P6> call, Response<POJO_PJ_P6> response) {
try {
POJO_PJ_P6 assessmentstu6 = (POJO_PJ_P6) response.body();
if (response.code() != 200) {
// Log.e("Network connected","Response code = "+response.code());
ResponseBody responseBody = response.errorBody();
if (responseBody != null) {
listener.onBodyError(responseBody);
} else if (responseBody == null) {
listener.onBodyErrorIsNull();
}
// Toast.makeText(, ""+loginRes.getAccesstoken(), Toast.LENGTH_SHORT).show();
// Log.e("Network connected","Response code = "+loginRes.getAccesstoken());
} else {
listener.onResponse(assessmentstu6);
}
} catch (Exception e) {
// Log.e("Network connect error",e.getMessage());
}
}
@Override
public void onFailure(Call<POJO_PJ_P6> call, Throwable t) {
Log.e("NT", t.getMessage());
try {
listener.onFailure(t);
} catch (Exception e) {
listener.onFailure(t);
// Log.e("Network connectLogin",t.getMessage());
}
}
});
}
Aggregations