Skip to content

Instantly share code, notes, and snippets.

@ZavenArra
Created July 3, 2013 20:45
Show Gist options
  • Save ZavenArra/5922647 to your computer and use it in GitHub Desktop.
Save ZavenArra/5922647 to your computer and use it in GitHub Desktop.
Android spring with robospice
class LoginRequestListener implements RequestListener< LoginUser > {
@Override
public void onRequestFailure( SpiceException e ) {
//showProgress(false);
if(e instanceof NoNetworkException){
Toast.makeText(LoginActivity.this, "Network connection is unavailable", Toast.LENGTH_LONG).show();
spiceManager.cancelAllRequests();
} else {
Toast.makeText(LoginActivity.this, "Error during request: " + e.getMessage(), Toast.LENGTH_LONG);
e.printStackTrace();
}
}
@Override
public void onRequestSuccess( LoginUser response ) {
if ( response == null ){
mEmailView.setError("Email address not found");
return;
}
// Found a user record, store the record and verify the user's country
mLoginFormView.setVisibility(View.GONE);
loginUser = response;
showCountryVerificationForm();
}
}
spiceManager.execute( new LoginRequest(mEmail), JSON_CACHE_KEY, DurationInMillis.NEVER, new LoginRequestListener() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment