title: How i pass incoming call phonenumber to main activity?
body: <p>I create a simple application for get incoming call number, work and show me the number with toast but i want to pass this variable to my main activity for processing...example send sms when call administrator number.I try this code but no data display in my UI...any idea?Help for this?</p>
  
  <pre><code>   public class IncomingCallReceiver extends BroadcastReceiver {
  
  
      @Override
      public void onReceive(Context context, Intent intent) {
              Bundle bundle = intent.getExtras();
  
              if(null == bundle)
                      return;
  
              Log.i("IncomingCallReceiver",bundle.toString());
  
              String state = bundle.getString(TelephonyManager.EXTRA_STATE);
  
              Log.i("IncomingCallReceiver","State: "+ state);
  
              if(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
              {
                      String phonenumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
  
                      Log.i("IncomingCallReceiver","Incomng Number: " + phonenumber);
  
                      String info = "Detect Calls sample application\nIncoming number: " + phonenumber;
  
  
  
                      Intent intentsend=new Intent("update");//Send data to update UI
                      intentsend.putExtra( "data","Admin call..."+info);
                      context.sendBroadcast(intentsend);
  
                      Toast.makeText(context, info, Toast.LENGTH_LONG).show();
              }
  </code></pre>
  
  <p>and my main activity is....</p>
  
  <pre><code>     @Override
  public void onResume() {
      super.onResume();
  
       updateReceiver=new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intentsend) {
                //get extras, do some stuff
              String data = intentsend.getStringExtra("data");
  
              textphone.setText(data);
  
            }
        };
        IntentFilter updateIntentFilter=new IntentFilter("update");
        registerReceiver(updateReceiver, updateIntentFilter);
  }
  </code></pre>