use of ctn.example.user.dvectn.POJO.POJO_DD_P1 in project DVECTN by tanaponudom.
the class NetworkConnectionManager method callServer_dd_p1.
// ///////////////////////////////////////////////////////////////////////////////////////////////
public void callServer_dd_p1(final OnNetworkCallback_DD_P1 listener, int member_id, int ex11, int ex12, int ex13, int ex14, int ex15) {
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.getDataDDP1(member_id, ex11, ex12, ex13, ex14, ex15);
call.enqueue(new Callback<POJO_DD_P1>() {
@Override
public void onResponse(Call<POJO_DD_P1> call, Response<POJO_DD_P1> response) {
try {
POJO_DD_P1 affective1 = (POJO_DD_P1) 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(affective1);
}
} catch (Exception e) {
// Log.e("Network connect error",e.getMessage());
}
}
@Override
public void onFailure(Call<POJO_DD_P1> 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