If an instance of an annotated class is created on a thread other than the UI thread, the handler which gets created does not get associated with the UI thread. The generated code is:
private Handler handler_ = new Handler();
This is creating a handler which is tied to the current thread.
According to the docs and a few StackOverflow questions, if it's created like this it'll be guaranteed to be connected to the UI thread:
private Handler handler_ = new Handler(Looper.getMainLooper());
If an instance of an annotated class is created on a thread other than the UI thread, the handler which gets created does not get associated with the UI thread. The generated code is:
private Handler handler_ = new Handler();
This is creating a handler which is tied to the current thread.
According to the docs and a few StackOverflow questions, if it's created like this it'll be guaranteed to be connected to the UI thread:
private Handler handler_ = new Handler(Looper.getMainLooper());