我的android studio项目有问题。当我尝试使用从我的Web服务改造来检索API时,我遇到了一些错误,表示"无法找到本地变量调用"
这是我的代码:
private void RegisUserTampung(String token)
{
Call<ResponseRegister> call = client.regisAccount("bearer " +token, "N", new Gson().toJson(regisUser));
call.enqueue(new Callback<ResponseRegister>() {
@Override
public void onResponse(Call<ResponseRegister> call, Response<ResponseRegister> response) {
ResponseRegister responseRegister = response.body();
if (responseRegister != null) {
Toast.makeText(VerifActivity.this, responseRegister.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<ResponseRegister> call, Throwable t) {
Toast.makeText(VerifActivity.this, "Failed POST Token to server ", Toast.LENGTH_SHORT).show();
}
});
这是我进入调试模式时的错误:
找不到本地变量&#39; call&#39;
对此问题的任何想法?
答案 0 :(得分:0)
你现在有2个同名变量
Call<ResponseRegister> **call** = client.regisAccount("bearer " +token, "N", new Gson().toJson(regisUser));
并且
public void onResponse(Call<ResponseRegister> **call**, Response<ResponseRegister>
尝试更改变量名称