title: broadcast receiver inside activity
body: <p>Hi folks how I can implement a Broadcast receiver in an activity that receives intent from a service along with some parameter's of int and string type?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I have this under the Activity:</p>
  
  <pre><code> private BroadcastReceiver ReceivefrmSERVICE = new BroadcastReceiver(){
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          Toast.makeText(context, "IN DA BroadCASTER",
                  Toast.LENGTH_LONG).show();
  
      }
  
     };
  </code></pre>
  
  <p>and I have this under a function in the service that is called on a event from another activity when a checked button is checked:</p>
  
  <pre><code> public void switchSpeaker(int hr, int min){
  
         Toast.makeText(Server.this, hr +" , " +min, Toast.LENGTH_LONG).show();
  
         Intent intent = new Intent(this, andRHOME.class);
         //intent.putExtra("sendMessage","1");
          startActivity(intent);
          /*PendingIntent pi = PendingIntent.getService(Server.this, 0, myIntent, 0);
          AlarmManager almmgr = (AlarmManager) getSystemService(ALARM_SERVICE);
          Calendar cldr = Calendar.getInstance();
          int min1 = cldr.get(Calendar.MINUTE);
          cldr.setTimeInMillis(System.currentTimeMillis());
          cldr.add(Calendar.SECOND, 30);
          almmgr.set(AlarmManager.RTC_WAKEUP, cldr.getTimeInMillis(), pi);*/
      }
  </code></pre>
  
  <p>But its crashing?? ,What to do? </p>