Associate the handler to the main thread

Previous implementation associate the handler to the current thread,
which can not be the main thread.

Related to #693

Generated code : 
```java
private Handler handler_ = new Handler(Looper.getMainLooper());
```