use of com.example.user.dvectn.POJO.POJO_PJ_P4 in project DVECTN by tanaponudom.
the class NetworkConnectionManager method callServer_pj_p4.
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void callServer_pj_p4(final OnNetworkCallback_PJ_P4 listener, int member_id, int ex41, int ex42, int ex43, int ex44, int ex45, int ex46, int ex47) {
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.getDataPJP4(member_id, ex41, ex42, ex43, ex44, ex45, ex46, ex47);
call.enqueue(new Callback<POJO_PJ_P4>() {
@Override
public void onResponse(Call<POJO_PJ_P4> call, Response<POJO_PJ_P4> response) {
try {
POJO_PJ_P4 assessmentstu4 = (POJO_PJ_P4) 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(assessmentstu4);
}
} catch (Exception e) {
// Log.e("Network connect error",e.getMessage());
}
}
@Override
public void onFailure(Call<POJO_PJ_P4> 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