2

I'm using Koush Ion on Android to handle net operations. I'd like to add a common handler to handle 401 unauthorized error. How i can do it?

thank you

Premier
  • 4,160
  • 6
  • 44
  • 58

1 Answers1

3
Ion.with(this)
            .load("http://google.com")
            .asString()
            .withResponse()
            .setCallback(new FutureCallback<Response<String>>() {
                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if(result.getHeaders().code()){
                        // ............
                    }
                }
            });

goodluck!

vuhung3990
  • 6,353
  • 1
  • 45
  • 44