title: How to open a fragment from BroadcastReceiver?
body: <p>I want to open a fragment through a sms-receiver, how should I implement that? Any help is appreciated. </p>
  
  <p>Receiver source code:</p>
  
  <pre><code>public class SMSReceiver extends BroadcastReceiver {
      private String body, vsn;
  
      @Override
      public void onReceive(Context context, Intent intent) {
      Bundle bundle = intent.getExtras();
      if (bundle == null)
          return;
  
      Object[] pdus = (Object[]) bundle.get("pdus");
  
      for (int i = 0; i &lt; pdus.length; i++) {
          SmsMessage sms = SmsMessage.createFromPdu((byte[]) pdus[i]);
          body = sms.getMessageBody().toString();
          PaymentTransaksi.setSmsDetail(body);
  
          Intent showPaymentForm = new Intent();
          showPaymentForm.setClassName("showPaymentForm",
                  "id.dutapulsa.bayartagihan.PaymentTransaksi");
          showPaymentForm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      }
  }
  </code></pre>
  
  <p>And this is the fragment source code:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
      paymentRootView = inflater.inflate(R.layout.payment_main, container,
                  false);
  
      return paymentRootView;
  }
  </code></pre>