웹 서비스 요청을 보내려고합니다. 그것은 작동하고 내 요청이 내 데이터베이스를 등록했습니다. 데이터베이스를 확인하면 내 요청 기록을 볼 수 있습니다. 또한 응답 방법과 onFailure 방법에 토스트 메시지를 작성합니다. 내 code가 작동하고 데이터베이스에 내 요청을 등록 했음에도 불구하고 onFailure 메서드에 대한 토스트 메시지가 표시됩니다.
이 개장 라이브러리 모듈에 사용되었습니다.
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
내 방법이 내 웹 서비스를 호출하고 있습니다.
public void uyekayitistek(){
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
kullaniciadiv=kullaniciadi.getText().toString();
emailv=email.getText().toString();
sifrev=sifre.getText().toString();
ManagerAll managerAll=new ManagerAll();
Call<Result> result=managerAll.getresult(kullaniciadiv,emailv,sifrev);
result.enqueue(new Callback<Result>() {
@Override
public void onResponse(Call<Result> call, Response<Result> response) {
Toast.makeText(getApplicationContext(),"register completed",Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Call<Result> call, Throwable t) {
Toast.makeText(getApplicationContext(),"register did not complete",Toast.LENGTH_LONG).show();
}
});
}
});
}
앱을 지점별로 디버깅 해보십시오.
Karan Mehta2021-03-03 15:34:50
그렇다면 onFailure는 무엇을 말합니까? throwable /exception도 기록해야합니다. 실패했음을 인쇄하는 데 도움이되지 않습니다.
a_local_nobody2021-03-03 15:34:50