title: Handling incoming call in android
body: <p>In my app i want to detect incoming call and i want to hide default incoming call layout with my custom layout,far now i have managed to get the state of incoming call but i'm not able to hide the default incoming call screen...below is my code and my android manifest file...any help will be appreciated..</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent intent) {
      // TODO Auto-generated method stub
      Log.i("DEBUG", "on recive called");
      String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
      String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
  
      if (TelephonyManager.EXTRA_STATE_RINGING.equals(state))
      {
          abortBroadcast();
          Log.d("MPR", "Its Ringing [" + number + "]");
          //start activity
          Intent i = new Intent();
          i.setClassName("com.ezest.callerid", "com.ezest.callerid.CustomCallActivity");
          i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          context.startActivity(i);
      }
  
      if (TelephonyManager.EXTRA_STATE_IDLE.equals(state))
      {
          Log.d("MPR", "Its Idle");
      }
      if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(state))
      {
          Log.d("MPR", "Its OffHook");
      }
  
  }
  </code></pre>
  
  <p>Manifest</p>
  
  <pre><code>&lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name" &gt;
  
      &lt;receiver android:name="MYPhoneStateListener"&gt;
          &lt;intent-filter android:priority="999999"&gt;
              &lt;action android:name="android.intent.action.PHONE_STATE"&gt;&lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;activity
          android:label="@string/app_name"
          android:name=".CallerIDActivity" &gt;
          &lt;intent-filter &gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity android:name="CustomCallActivity"&gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  </code></pre>