Question: I know a handler is bound to the thread's message queue in which it is created, but what if i create a handler in a service and posting a runnable declared in activity to which my service is bound.
For example:
In service:-

```
Handler handler=new Handler();
handler.post(Mainactivity.runnable);

In activity inside oncreate method:-

Runnable runnable=new Runnable(){
    public void run{
       //some code here
    }
};

```

Can someone please explain me what's happening here?

Answer: 
Because after preprocessing, your code will look similar to that:

```
a[i] = {  return (a[i] >=0)? (int)(a[i]+0.5) : (int)(a[i]-0.5) ; }

```

If you like to stick to macro, declare it as:

```
#define round(N) ((N) >=0)? (int)((N)+0.5) : (int)((N)-0.5)

```

But this is still not really correct because of int/float mixing. That is however already a different topic.
If you insist on writing this yourself, you should replace the icky macro with a safer, cleaner function:

```
inline int int_round (double d)
{
  return (int) ( d >= 0 ? d+0.5 : d-0.5 );
}

```

This should yield the very same machine code.