public void onClick(View view) {
   String number = (String) view.getTag();
   if (!TextUtils.isEmpty(number)) {
     // Here, "number" can either be a PSTN phone number or a
     // SIP address.  So turn it into either a tel: URI or a
     // sip: URI, as appropriate.
     Uri callUri;
     if (PhoneNumberUtils.isUriNumber(number)) {
       callUri = Uri.fromParts("sip", number, null);
     } else {
       callUri = Uri.fromParts("tel", number, null);
     }
     StickyTabs.saveTab(RecentCallsListActivity.this, getIntent());
     startActivity(new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri));
   }
 }
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case CONTEXT_MENU_ITEM_DELETE:
        {
          // Convert the menu info to the proper type
          AdapterView.AdapterContextMenuInfo menuInfo;
          try {
            menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
          } catch (ClassCastException e) {
            Log.e(TAG, "bad menuInfoIn", e);
            return false;
          }

          Cursor cursor = (Cursor) mAdapter.getItem(menuInfo.position);
          int groupSize = 1;
          if (mAdapter.isGroupHeader(menuInfo.position)) {
            groupSize = mAdapter.getGroupSize(menuInfo.position);
          }

          StringBuilder sb = new StringBuilder();
          for (int i = 0; i < groupSize; i++) {
            if (i != 0) {
              sb.append(",");
              cursor.moveToNext();
            }
            long id = cursor.getLong(ID_COLUMN_INDEX);
            sb.append(id);
          }

          getContentResolver().delete(Calls.CONTENT_URI, Calls._ID + " IN (" + sb + ")", null);
          return true;
        }
      case CONTEXT_MENU_CALL_CONTACT:
        {
          StickyTabs.saveTab(this, getIntent());
          startActivity(item.getIntent());
          return true;
        }
      default:
        {
          return super.onContextItemSelected(item);
        }
    }
  }
 private void callEntry(int position) {
   if (position < 0) {
     // In touch mode you may often not have something selected, so
     // just call the first entry to make sure that [send] [send] calls the
     // most recent entry.
     position = 0;
   }
   final Cursor cursor = (Cursor) mAdapter.getItem(position);
   if (cursor != null) {
     String number = cursor.getString(NUMBER_COLUMN_INDEX);
     if (TextUtils.isEmpty(number)
         || number.equals(CallerInfo.UNKNOWN_NUMBER)
         || number.equals(CallerInfo.PRIVATE_NUMBER)
         || number.equals(CallerInfo.PAYPHONE_NUMBER)) {
       // This number can't be called, do nothing
       return;
     }
     Intent intent;
     // If "number" is really a SIP address, construct a sip: URI.
     if (PhoneNumberUtils.isUriNumber(number)) {
       intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts("sip", number, null));
     } else {
       // We're calling a regular PSTN phone number.
       // Construct a tel: URI, but do some other possible cleanup first.
       int callType = cursor.getInt(CALL_TYPE_COLUMN_INDEX);
       if (!number.startsWith("+")
           && (callType == Calls.INCOMING_TYPE || callType == Calls.MISSED_TYPE)) {
         // If the caller-id matches a contact with a better qualified number, use it
         number = getBetterNumberFromContacts(number);
       }
       intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts("tel", number, null));
     }
     StickyTabs.saveTab(this, getIntent());
     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
     startActivity(intent);
   }
 }
  public void onClick(DialogInterface dialog, int which) {
    if (mPhoneItemList.size() > which && which >= 0) {
      PhoneItem phoneItem = mPhoneItemList.get(which);
      long id = phoneItem.id;
      String phone = phoneItem.phoneNumber;

      if (mMakePrimary) {
        ContentValues values = new ContentValues(1);
        values.put(Data.IS_SUPER_PRIMARY, 1);
        mContext
            .getContentResolver()
            .update(ContentUris.withAppendedId(Data.CONTENT_URI, id), values, null, null);
      }

      if (mSendSms) {
        ContactsUtils.initiateSms(mContext, phone);
      } else {
        StickyTabs.saveTab(mContext, mStickyTab);
        ContactsUtils.initiateCall(mContext, phone);
      }
    } else {
      dialog.dismiss();
    }
  }