title: BroadcastReceiver from MainActivity does not receive extra
body: <p>Consider this scenario, there's three classes involved: this is an alarm app, you want to show a button when the alarm service is on and hide it when the alarm is off. I want to BroadcastReceiver in MainActivity receive an extra from the other two classes to determine whether should the button should be showed or hidden.</p>
  
  <p>This is my BroadcastReceiver in MainActivity, buttonVisibility should be receiving extras.</p>
  
  <pre class="lang-java prettyprint-override"><code>BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
              if (getIntent().getExtras() != null) {
                  buttonVisibility = getIntent().getStringExtra("visibility");
  
                  switch (buttonVisibility) {
                      case "visible":
                          showButtonMatikanAlarm();
                          break;
                      case "gone":
                          hideButtonMatikanAlarm();
                          break;
                      default:
                          //do nothing
                          break;
                  }
              }
          }
  };
  </code></pre>
  
  <p>On the <code>onCreate</code> method I already register the broadcastReceiver:</p>
  
  <pre class="lang-java prettyprint-override"><code>registerReceiver(broadcastReceiver, new IntentFilter("anim button"));
  </code></pre>
  
  <p>This is the snippet of code that send a broadcast to show button, for context this is in a receiver class and inside an <code>onRecieve</code> method:</p>
  
  <pre class="lang-java prettyprint-override"><code>Intent intentShowButtonMatikan = new Intent("anim button");
  intentShowButtonMatikan.putExtra("visibility", "visible");
  context.sendBroadcast(intentShowButtonMatikan);
  </code></pre>
  
  <p>Code that send a broadcast to hide button, for context this resides in a method inside a dialog class. When a button of a dialog clicked, it should send extra:</p>
  
  <pre class="lang-java prettyprint-override"><code>Intent intentHideButtonMatikan = new Intent("anim button");
  intentHideButtonMatikan.putExtra("visibility", "gone");
  getContext().sendBroadcast(intentHideButtonMatikan);
  </code></pre>
  
  <p>When the code runs, BroadcastReciever is called but never get the extra and <code>buttonVisibility</code> returns null. What's wrong? </p>
  
  <p>Any help will be appreciated. I'm a starter at Android, sorry if it turns out a noob question.</p>