Note that there are some explanatory texts on larger screens.

plurals
  1. PORookie mistake:Trying to pass outgoing number to activity
    primarykey
    data
    text
    <p>I am retrieving the outgoing number from the broadcast receiver and trying to send it to the activity thru a method getNumber() however the value is coming out null. Im my code below In the activity class the String phonenumber is null</p> <p>BroadcastReciever Class:</p> <pre><code>public class OutgoingBroadcastReceiver extends BroadcastReceiver { String phonenumber = null; @Override public void onReceive(Context context, Intent intent) { phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) { Log.i("System out", "IN OUTGOING CALL......... :IF"); MyPhoneStateListener phoneListener = new MyPhoneStateListener( context); TelephonyManager telephony = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); telephony.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); } else { Log.i("System out", "IN INCOMING CALL.........:else:receiver"); } public String getNumber() { return phonenumber; } </code></pre> <p>Activity Class:</p> <pre><code>public class OutgoingCallScreenDisplay extends Activity </code></pre> <p>{</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.outgoing_main); OutgoingBroadcastReceiver outreciever = new OutgoingBroadcastReceiver(); String phonenumber= outreciever.getNumber();//this is coming out NULL needs to be the outgoing number } </code></pre>
    singulars
    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.
    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