Rookie mistake:Trying to pass outgoing number to activity
<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>
