Note that there are some explanatory texts on larger screens.

plurals
  1. POabortBroadcast() from activity
    primarykey
    data
    text
    <p>using the following code i can abortBroadcast() from my broadcastreciver and bundle the sms and address to my activity, what i am trying to do is abortBroadcast() from my activity, so my activity checks if the address is the same as one of my stored addresses and then abortBroadcast(), but i cant find a way to do this, is it in any way possible to abortBroadcast() from my activity or any way of checking details from an activity then allow the broadcastreciver to abort?</p> <p>heres my code:</p> <pre><code> @Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); // a notification message String messages = ""; if (extras != null) { Object[] smsExtra = (Object[]) extras.get("pdus"); for (int i = 0; i &lt; smsExtra.length; ++i) { SmsMessage sms = SmsMessage.createFromPdu((byte[]) smsExtra[i]); String body = sms.getMessageBody().toString();// sf String address = sms.getOriginatingAddress(); messages += "SMS from " + address + " :\n"; messages += body + "\n"; } Intent data = new Intent(context, Details.class); data.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); for (int i = 0; i &lt; smsExtra.length; ++i) { // get sms message SmsMessage sms = SmsMessage.createFromPdu((byte[]) smsExtra[i]); String body = sms.getMessageBody().toString(); String address = sms.getOriginatingAddress().toString(); // bundle Bundle bundle1 = new Bundle(); bundle1.putString("title", body); bundle1.putString("title2", address); data.putExtras(bundle1); context.startActivity(data); abortBroadcast(); } } } </code></pre> <p>}</p> <p>in my activity:</p> <pre><code> Bundle bundle1 = this.getIntent().getExtras(); String title = bundle1.getString("title"); String title2 = bundle1.getString("title2"); ((EditText) findViewById(R.id.ettext)).setText(title); ((EditText) findViewById(R.id.etnumber)).setText(title2); mSms =(TextView)findViewById(R.id.tvsms); String sms = mSms.getText().toString(); if (sms.equals(title2)) abortBroadcast();???? </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload