title: End Call in Android
body: <p>I'm trying to end a new outgoing call after few seconds. Here is my code:</p>
  
  <pre><code>public class phonecalls extends Activity {
      ComponentName cn;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          call();
      }
      private void call() {
          try {
              Intent callIntent = new Intent(Intent.ACTION_CALL);
              callIntent.setData(Uri.parse("tel:123456789"));
              startActivity(callIntent);
              cn = new ComponentName(getApplicationContext(), Receiver.class);
          } catch (ActivityNotFoundException activityException) {
              Log.e("dialing-example", "Call failed", activityException);
          }
      }
  }
  </code></pre>
  
  <p>My receiver class is:</p>
  
  <pre><code>public class Receiver extends BroadcastReceiver {
      public void onReceive(Context context, Intent intent) {
          if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
              setResultData(null);
          }
      }
  }
  </code></pre>
  
  <p>I am unable to abort the outgoing call. I'm new to Android and can't seem to get this to work. </p>