title: How to start new activity on BroadcastReceiver when I click on button
body: <p>I am trying to make application, that can extends "BroadcastReceiver", and on the xml GUI there is a button, I am trying to open new Activity(GUI) when I press on it. I know how to do it when I extends Activity, but not when I extends BroadcastReceiver. this is my java code:</p>
  
  <pre><code>import info.kfsoft.android.R.raw;
  import android.app.Notification;
  import android.app.NotificationManager;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.media.AudioManager;
  import android.media.MediaPlayer;
  import android.os.Bundle;
  import android.telephony.SmsMessage;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class SMSReceiver extends BroadcastReceiver
  {
  
      MediaPlayer ourSong;
      TextView display;
  
  
      public void onReceive(Context context, Intent intent)
      {
          NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
          ourSong = MediaPlayer.create(context, R.raw.music2);
  
  
          Bundle myBundle = intent.getExtras();
          SmsMessage [] messages = null;
          String strMessage = "";
  
          if (myBundle != null)
          {
              Object [] pdus = (Object[]) myBundle.get("pdus");
              messages = new SmsMessage[pdus.length];
  
              for (int i = 0; i &lt; messages.length; i++)
              {
                  messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
                 strMessage += messages[i].getMessageBody();                  
             }            
              Toast.makeText(context, strMessage, Toast.LENGTH_SHORT).show();
  
              AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
                  am.setStreamVolume(AudioManager.STREAM_MUSIC,am.getStreamMaxVolume(AudioManager.STREAM_MUSIC),0);            
              Toast.makeText(context, strMessage, Toast.LENGTH_SHORT).show();            
              ourSong.start();           
          }
      }
      public void a(){
  
      }
  
  }
  </code></pre>
  
  <p>and this is my xml RelativeLayout that works with the previous java code:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="info.kfsoft.android.MainActivity$PlaceholderFragment" &gt;
  
      &lt;TextView
          android:id="@+id/msg"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" /&gt;
  
      &lt;Button
          android:id="@+id/cmd"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/msg"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="98dp"
          android:text="Button" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>NOW I want to open new intent when I press the button (WITH @+ID/CMD):</p>
  
  <p>This is the Jave code of the new intent:</p>
  
  <pre><code>public class AboutUs extends Activity{
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
              setContentView(R.layout.about);
          }
  
      }
  </code></pre>