Okhttp response callbacks on the main thread

From my understanding, Okhttp callbacks run on the main thread so why do I get this error ?

This is not true. Callbacks run on a background thread. If you want to immediately process something in the UI you will need to post to the main thread.

Since you already have a wrapper around the callback you can do this internally in your helper so that all HttpCallback methods are invoked on the main thread for convenience.

Leave a Comment