I am using Handler in an android project to give a callback to to the main/ui thread.
if (mHandler == null) {
mHandler = new Handler(Looper.getMainLooper());
}
mHandler.post(new Runnable() {
public void run() {
freeBeePlaybackEventListener.onError(freeBeeError);
}
});
When I am creating the handler object i.e. mHandler , I am checking whether the handler already exists or not. If not, then I am creating the handler i.e. using a singleton pattern. My question is: Is creation of the handler object thread safe ?
Thanks.