send message not reaching the handler in activity
<p>I am having the service and activity. inside service i am sending the message.
I am trying to catch it inside the main activity. But message is not reaching the handler in activity.</p>

<p>Please see the code below.</p>

<p>Service:</p>

<pre><code>Handler handler = new Handler(Looper.getMainLooper());
    handler.sendEmptyMessage(112345);
</code></pre>

<p>MainActivity:</p>

<pre><code>handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            Toast.makeText(MainActivity.this, "handled message successfully", Toast.LENGTH_SHORT).show();
            if ( msg.what == 1234 ) {
                Toast.makeText(MainActivity.this, "handled message successfully", Toast.LENGTH_SHORT).show();
            }
        }
    };
</code></pre>

<p>Can anyone tell me why it is not reaching the handler in the activity.
As far as i know </p>
