title: Registering and unregistering BroadcastReceiver in a fragment
body: <p>My app has an action bar with 3 fragment tabs.
  In the second fragment I register and unregister a BroadcastReceiver.
  I unregister the receiver in <code>onPause</code> and register it in <code>onCreateView</code> and in <code>onResume</code>.</p>
  
  <pre><code>getActivity().registerReceiver(this.batteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>getActivity().unregisterReceiver(batteryInfoReceiver);
  </code></pre>
  
  <p><strong>1) Is it all right to register the same reciever twice (in onCreateView and onResume)?(is it harmless?)</strong></p>
  
  <p><strong>2) Is it enough to just register the reciever in onResume?</strong></p>