android-studio - 在响应代码 400 上,我无法进行数据改造
问题描述
private void getotp(String name,String phone, String dob){
btnVerify.setClickable(false);
dialog.show();
//Toast.makeText(BookToken.this,blockname,Toast.LENGTH_LONG).show();
Retrofit retrofit = RetrofitClient.getRetrofitInstance();
apiInterface api = retrofit.create(apiInterface.class);
Call<otp> call = api.SendOtp("covishield",dose,age, blockname, location, phone);
call.enqueue(new Callback<otp>() {
@Override
public void onResponse(Call<otp> call, Response<otp> response) {
if (response.code() == 200) {
otp resp = response.body();
String Success = resp.getSuccess();
dialog.cancel();
if (response.code() == 200) {
otp resp = response.body();
String msg= resp.getMessage();
dialog.cancel();
btnVerify.setClickable(true);
}
}else {
dialog.cancel();
btnVerify.setClickable(true);
}
}
@Override
public void onFailure(Call<otp> call, Throwable t) {
Toasty.error(BookToken.this, "SomeThing Went Wrong", Toast.LENGTH_SHORT, true).show();
dialog.cancel();
}
});
}
这里是响应代码 400 api echo json data on value message,但是在我的方法上,如果我尝试获取消息,我可以得到消息,由于空对象引用,它的改造或 httpintercepter 错误,我们将强制关闭?请让我知道
解决方案
推荐阅读
- sql - 列出具有空状态字段的单个发票
- excel - 与在 Internet Explorer 中打开的 PDF 交互的 VBA 代码?(没有发送键)
- python - 将数据压缩为json帖子的字符串而不保存文件
- python - 如何在两行中写入语句?
- docker - 无法启动服务 couchdb:b'driver 在端点上编程外部连接失败
- java - 如何在 Java 中解析这个 JSON 数据
- .net - ADAL.NET - 为什么在从 API 到 API 对 OnBehalfOf 进行身份验证时需要 AcquireTokenAsync?
- reactjs - React Switch Route 无需重新加载所有页面
- api - Apex 传奇 API
- c - 对“yylval”和“yyerror”的未定义引用