android - Enqueue callback not called -


i using retrofit2 , recognized callback call.enqueue not called.

retrofit retrofit = new retrofit.builder().baseurl(usuarioservice.base_url).addconverterfactory(gsonconverterfactory.create(usuarioservice.g)).build(); usuarioservice service = retrofit.create(usuarioservice.class); call<string> user = service.verificarusuario(login.gettext().tostring(), senha.gettext().tostring()); user.enqueue(new retrofit2.callback<string>() {     @override     public void onresponse(call<string> call, response<string> response) {         string resultado = response.body();          if (resultado.equals("false")) {             toast toast = toast.maketext(mainactivity.this, "senha ou usuário não existente", toast.length_short);             toast.setgravity(gravity.top | gravity.center_vertical, 0, 0);             toast.show();         } else {             if (resultado.equals("true")) {                 toast toast = toast.maketext(mainactivity.this, "acesso permitido", toast.length_short);                 toast.setgravity(gravity.center_horizontal | gravity.center_vertical, 0, 0);                 toast.show();                  intent intent = new intent(mainactivity.this, menudrawer.class);                 intent.putextra("chave1", login.gettext().tostring());                  startactivity(intent);                  finish();             }         }     }      @override     public void onfailure(call<string> call, throwable t) {     } }); 

suddenly problem start happen, knows how fix it? these issue not happen until moments ago, not know happened.

these happened when i'm using mobile data, when i'm used wifi these never happened yet.

you have empty onfailure implementation callback may called nothing happens. try log information in onfailure method.

@override public void onfailure(call<string> call, throwable t) {    log.w("mytag", "requestfailed", t);  } 

and you'll see if request failed , why.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -