title: BroadcastReceiver Not receiving Broadcast
body: <p>I am trying to broadcast a toast message with the following code extending <code>Activity</code>. But the broadcast is not received by another <code>Activity</code>, the toast is not displayed. Can someone solve my error? The main activity is <strong>SendBroadcast.java</strong></p>
  
  <pre><code>import android.app.Activity;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  
  public class SendBroadcast extends Activity {
  
      public static String BROADCAST_ACTION =
                               "com.unitedcoders.android.broadcasttest.SHOWTOAST";
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
      }
  
      public void sendBroadcast(View v) {
          Intent broadcast = new Intent();
          broadcast.setAction(BROADCAST_ACTION);
          sendBroadcast(broadcast);
      }
  }
  </code></pre>
  
  <p>Toast Display Activity is <strong>ToastDisplay.java</strong></p>
  
  <pre><code>import android.app.Activity;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.widget.Toast;
  
  public class ToastDisplay extends Activity {
  
      private BroadcastReceiver receiver = new BroadcastReceiver() {
  
          @Override
          public void onReceive(Context context, Intent intent) {
              Toast.makeText(getApplicationContext(), "received",
                      Toast.LENGTH_SHORT).show();
          }
      };
  
      @Override
      protected void onResume() {
          IntentFilter filter = new IntentFilter();
          filter.addAction(SendBroadcast.BROADCAST_ACTION);
          registerReceiver(receiver, filter);
          super.onResume();
      }
  
      @Override
      protected void onPause() {
          unregisterReceiver(receiver);
          super.onPause();
      }
  }
  </code></pre>
  
  <p>and <strong>manifest.xml</strong> is as follows</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.broad"
      android:versionCode="1"
      android:versionName="1.0" &gt;
      &lt;uses-sdk android:minSdkVersion="3" /&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name" &gt;
          &lt;activity
              android:name=".SendBroadcast"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;receiver android:name=".ToastReceiver" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.unitedcoders.android.broadcasttest.SHOWTOAST" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>