Example usage for android.telephony PhoneNumberUtils stripSeparators

List of usage examples for android.telephony PhoneNumberUtils stripSeparators

Introduction

In this page you can find the example usage for android.telephony PhoneNumberUtils stripSeparators.

Prototype

public static String stripSeparators(String phoneNumber) 

Source Link

Document

Strips separators from a phone number string.

Usage

From source file:Main.java

/**
 * "Flattens" a phone number into a standard format by eliminating all symbols, etc.
 *///from  www.j a v a2s. c  om
public static String flattenPhone(String formattedPhone) {
    String flattened = PhoneNumberUtils.stripSeparators(formattedPhone);
    flattened = flattened.replaceAll("\\+", "");
    if (flattened.charAt(0) == '1')
        flattened = flattened.replaceFirst("1", "");
    return flattened;
}

From source file:com.fututel.utils.contacts.ContactsSearchAdapter.java

@Override
public final CharSequence convertToString(Cursor cursor) {
    CharSequence number = ContactsWrapper.getInstance().transformToSipUri(mContext, cursor);
    if (!TextUtils.isEmpty(number)) {
        String stripNbr = PhoneNumberUtils.stripSeparators(number.toString());
        return Filter.rewritePhoneNumber(mContext, currentAccId, stripNbr);
    }// w  w w .  j av a2 s . com
    return number;
}

From source file:com.textuality.lifesaver2.Columns.java

public JSONObject cursorToJSON(Cursor cursor) {
    setColumns(cursor);//from   ww  w.j  a  va  2 s  .c  o m
    JSONObject json = new JSONObject();
    try {
        for (int i = 0; i < mNames.length; i++) {
            int col = mColumns[i];
            if (cursor.isNull(col))
                continue;
            switch (mTypes[i]) {
            case STRING:
                String str = cursor.getString(col);
                if (mNames[i].equals("number")) {
                    json.put("name", mNameFinder.find(str));
                } else if (mNames[i].equals("address")) {
                    str = PhoneNumberUtils.formatNumber(str);
                    str = PhoneNumberUtils.stripSeparators(str);
                    json.put("name", mNameFinder.find(str));
                }
                json.put(mNames[i], str);
                break;
            case INT:
                json.put(mNames[i], cursor.getInt(col));
                break;
            case LONG:
                long val = cursor.getLong(col);
                json.put(mNames[i], val);
                if (mNames[i].equals("date")) {
                    json.put("tzoffset", mTZ.getOffset(val));
                }
                break;
            case FLOAT:
                json.put(mNames[i], cursor.getFloat(col));
                break;
            case DOUBLE:
                json.put(mNames[i], cursor.getDouble(col));
                break;
            }
        }
    } catch (JSONException e) {
        throw new RuntimeException(e);
    }

    return json;
}

From source file:com.example.android.oauthTesting_slidingTabBasic.SlidingTabsBasicFragment.java

/**
 * This is called after the {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} has finished.
 * Here we can pick out the {@link View}s we need to configure from the content view.
 *
 * We set the {@link ViewPager}'s adapter to be an instance of {@link SamplePagerAdapter}. The
 * {@link SlidingTabLayout} is then given the {@link ViewPager} so that it can populate itself.
 *
 * @param view View created in {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}
 *///from w w w . j  a  v a  2 s.c o m
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // BEGIN_INCLUDE (setup_viewpager)
    // Get the ViewPager and set it's PagerAdapter so that it can display items
    mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
    //mViewPager.setAdapter(new SimpleViewPagerAdapter(this.getChildFragmentManager()));
    mViewPager.setAdapter(new SimpleViewPagerAdapter(this.getChildFragmentManager()));
    // END_INCLUDE (setup_viewpager)

    // BEGIN_INCLUDE (setup_slidingtablayout)
    // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had
    // it's PagerAdapter set.
    mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
    mSlidingTabLayout.setViewPager(mViewPager);

    final EditText recipient_phone = (EditText) view.findViewById(R.id.recipient_phone);
    recipient_phone.addTextChangedListener(new PhoneNumberFormattingTextWatcher());

    final Button send_sms = (Button) view.findViewById(R.id.send_sms);
    send_sms.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String number = recipient_phone.getText().toString();
            String s = PhoneNumberUtils.stripSeparators(recipient_phone.getText().toString());

            String q = PhoneNumberUtils.formatNumber(s, "US");
            String r = q;

        }
        // END_INCLUDE (setup_slidingtablayout)
    });

    //----FACEBOOK OAUTH TRIAL STUFF----//
    callbackManager = CallbackManager.Factory.create();
    loginButton = (LoginButton) view.findViewById(R.id.login_button);

    loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            int a = 5;
            int b = a;
        }

        @Override
        public void onCancel() {

        }

        @Override
        public void onError(FacebookException e) {

        }
    });
    // END_INCLUDE (fragment_onviewcreated)

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail().build();

    mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
            .enableAutoManage(getActivity() /* FragmentActivity */, this /* OnConnectionFailedListener */)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();

    SignInButton signInButton = (SignInButton) view.findViewById(R.id.sign_in_button);
    signInButton.setOnClickListener(this);
}

From source file:com.example.places.fragments.PlaceInfoFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    toolbar = (Toolbar) view.findViewById(R.id.place_details_toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayShowHomeEnabled(true);

    progressBar = (ProgressBar) view.findViewById(R.id.place_details_progress);
    coverView = (ImageView) view.findViewById(R.id.place_details_cover);
    recyclerView = (RecyclerView) view.findViewById(R.id.place_details_recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    floatingActionButton = (FloatingActionButton) view.findViewById(R.id.place_details_actionbutton);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override/*  w w  w. j  a v a 2  s  . com*/
        public void onClick(View v) {
            String phoneNumber = place.get(Place.PHONE);
            if (phoneNumber != null) {
                String strippedNumber = PhoneNumberUtils.stripSeparators(phoneNumber);
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + strippedNumber));
                listener.onCallPhone(intent);
            }
        }
    });

    toolbar.setTitle(place.get(Place.NAME));
    int actionButtonVisibility = place.has(Place.PHONE) ? View.VISIBLE : View.GONE;
    floatingActionButton.setVisibility(actionButtonVisibility);

    fetchPlaceInfo();
}

From source file:com.csipsimple.utils.contacts.ContacksSearchGridAdapter.java

@Override
public final CharSequence convertToString(Cursor cursor) {
    CharSequence number = ContactsWrapper.getInstance().transformToSipUri(mContext, cursor);
    boolean isExternalPhone = ContactsWrapper.getInstance().isExternalPhoneNumber(mContext, cursor);
    if (!TextUtils.isEmpty(number) && isExternalPhone) {
        String stripNbr = PhoneNumberUtils.stripSeparators(number.toString());
        return Filter.rewritePhoneNumber(mContext, currentAccId, stripNbr);
    }//from w  ww.  java2  s  . c  o  m
    return number;
}

From source file:com.abcvoipsip.ui.dialpad.DialerFragment.java

@Override
public void placeCall() {
    if (service == null) {
        return;/*from w  w  w  .  j a  va2  s  .c o m*/
    }
    String toCall = "";
    Long accountToUse = SipProfile.INVALID_ID;
    // Find account to use
    SipProfile acc = accountChooserButton.getSelectedAccount();
    if (acc != null) {
        accountToUse = acc.id;
    }
    // Find number to dial
    if (isDigit) {
        toCall = PhoneNumberUtils.stripSeparators(digits.getText().toString());
    } else {
        toCall = digits.getText().toString();
        // Add default scheme
        if (!toCall.startsWith("sip:") && !toCall.startsWith("sips:") && !toCall.startsWith("tel:")) {
            if (acc != null && acc.transport == SipProfile.TRANSPORT_TLS) {
                toCall = "sips:" + toCall;
            } else {
                toCall = "sip:" + toCall;
            }
        }
    }

    if (TextUtils.isEmpty(toCall)) {
        return;
    }

    // Well we have now the fields, clear theses fields
    digits.getText().clear();

    // -- MAKE THE CALL --//
    if (accountToUse >= 0) {
        // It is a SIP account, try to call service for that
        try {
            service.makeCall(toCall, accountToUse.intValue());
        } catch (RemoteException e) {
            Log.e(THIS_FILE, "Service can't be called to make the call");
        }
    } else if (accountToUse != SipProfile.INVALID_ID) {
        // It's an external account, find correct external account
        CallHandler ch = new CallHandler(getActivity());
        ch.loadFrom(accountToUse, toCall, new onLoadListener() {
            @Override
            public void onLoad(CallHandler ch) {
                placePluginCall(ch);
            }
        });
    }
}

From source file:com.sonetel.ui.dialpad.DialerFragment.java

private void checkDialingCountry(String dialedNum1) {
    // TODO Auto-generated method stub

    String dialedNum = PhoneNumberUtils.stripSeparators(dialedNum1);

    if (dialedNum.startsWith("+91") || dialedNum.startsWith("0091") || dialedNum.startsWith("01191")) {
        countryView.setImageResource(R.drawable.flag_ind);
        countryName.setText("India");
    } //1/*from   www .j  ava 2 s  .  c om*/
    else if (dialedNum.startsWith("+46") || dialedNum.startsWith("0046") || dialedNum.startsWith("01146")) {
        countryView.setImageResource(R.drawable.flag_swe);
        countryName.setText("Sweden");
    } //2
    else if (dialedNum.startsWith("+61") || dialedNum.startsWith("0061") || dialedNum.startsWith("01161")) {
        countryView.setImageResource(R.drawable.flag_aus);
        countryName.setText("Australia");
    } //3
    else if (dialedNum.startsWith("+92") || dialedNum.startsWith("0092") || dialedNum.startsWith("01192")) {
        countryView.setImageResource(R.drawable.flag_pak);
        countryName.setText("Pakisthan");
    } //4
    else if (dialedNum.startsWith("+93") || dialedNum.startsWith("0093") || dialedNum.startsWith("01193")) {
        countryView.setImageResource(R.drawable.flag_afg);
        countryName.setText("Afghanistan");
    } //5
    else if (dialedNum.startsWith("+355") || dialedNum.startsWith("00355") || dialedNum.startsWith("011355")) {
        countryView.setImageResource(R.drawable.flag_alb);
        countryName.setText("Albania");
    } //6
    else if (dialedNum.startsWith("+1264") || dialedNum.startsWith("001264")
            || dialedNum.startsWith("0111264")) {
        countryView.setImageResource(R.drawable.flag_aia);
        countryName.setText("Anguilla");
    } //7
    else if (dialedNum.startsWith("+1242") || dialedNum.startsWith("001242")
            || dialedNum.startsWith("0111242")) {
        countryView.setImageResource(R.drawable.flag_bah);
        countryName.setText("Bahamas");
    } //8
    else if (dialedNum.startsWith("+1268") || dialedNum.startsWith("001268")
            || dialedNum.startsWith("0111268")) {
        countryView.setImageResource(R.drawable.flag_agt);
        countryName.setText("Antigua and Barbuda");
    } //18
    else if (dialedNum.startsWith("+1242") || dialedNum.startsWith("001242")
            || dialedNum.startsWith("0111242")) {
        countryView.setImageResource(R.drawable.flag_bah);
        countryName.setText("Bahamas");
    } //24
    else if (dialedNum.startsWith("+971") || dialedNum.startsWith("00971") || dialedNum.startsWith("011971")) {
        countryView.setImageResource(R.drawable.flag_uae);
        countryName.setText("UAE");
    } //10
    else if (dialedNum.startsWith("+966") || dialedNum.startsWith("00966") || dialedNum.startsWith("011966")) {
        countryView.setImageResource(R.drawable.flag_ksa);
        countryName.setText("Saudi Arabia");
    } //11
    else if (dialedNum.startsWith("+65") || dialedNum.startsWith("0065") || dialedNum.startsWith("01165")) {
        countryView.setImageResource(R.drawable.flag_sin);
        countryName.setText("Singapore");
    } //12
    else if (dialedNum.startsWith("+213") || dialedNum.startsWith("00213") || dialedNum.startsWith("011213")) {
        countryView.setImageResource(R.drawable.flag_alg);
        countryName.setText("Algeria");
    } //13
    else if (dialedNum.startsWith("+1684") || dialedNum.startsWith("001684")
            || dialedNum.startsWith("0111684")) {
        countryView.setImageResource(R.drawable.flag_asa);
        countryName.setText("American Samoa");
    } //14
    else if (dialedNum.startsWith("+376") || dialedNum.startsWith("00376") || dialedNum.startsWith("011376")) {
        countryView.setImageResource(R.drawable.flag_and);
        countryName.setText("Andorra");
    } //15
    else if (dialedNum.startsWith("+244") || dialedNum.startsWith("00244") || dialedNum.startsWith("011244")) {
        countryView.setImageResource(R.drawable.flag_ang);
        countryName.setText("Angola");
    } //16
    else if (dialedNum.startsWith("+672") || dialedNum.startsWith("00672") || dialedNum.startsWith("011672")) {
        countryView.setImageResource(R.drawable.flag_ata);
        countryName.setText("Antarctica");
    } //17
    else if (dialedNum.startsWith("+54") || dialedNum.startsWith("0054") || dialedNum.startsWith("01154")) {
        countryView.setImageResource(R.drawable.flag_arg);
        countryName.setText("Argentina");
    } //19
    else if (dialedNum.startsWith("+374") || dialedNum.startsWith("00374") || dialedNum.startsWith("011374")) {
        countryView.setImageResource(R.drawable.flag_arg);
        countryName.setText("Armenia");
    } //20
    else if (dialedNum.startsWith("+297") || dialedNum.startsWith("00297") || dialedNum.startsWith("011297")) {
        countryView.setImageResource(R.drawable.flag_aru);
        countryName.setText("Aruba");
    } //21
    else if (dialedNum.startsWith("+43") || dialedNum.startsWith("0043") || dialedNum.startsWith("01143")) {
        countryView.setImageResource(R.drawable.flag_aut);
        countryName.setText("Austria");
    } //22
    else if (dialedNum.startsWith("+994") || dialedNum.startsWith("00994") || dialedNum.startsWith("011994")) {
        countryView.setImageResource(R.drawable.flag_aze);
        countryName.setText("Azerbaijan");
    } //23
    else if (dialedNum.startsWith("+973") || dialedNum.startsWith("00973") || dialedNum.startsWith("011973")) {
        countryView.setImageResource(R.drawable.flag_brn);
        countryName.setText("Bahrain");
    } //25
    else if (dialedNum.startsWith("+880") || dialedNum.startsWith("00880") || dialedNum.startsWith("011880")) {
        countryView.setImageResource(R.drawable.flag_ban);
        countryName.setText("Bangladesh");
    } //26
    else if (dialedNum.startsWith("+1246") || dialedNum.startsWith("001246")
            || dialedNum.startsWith("0111246")) {
        countryView.setImageResource(R.drawable.flag_bar);
        countryName.setText("Barbados");
    } //27
    else if (dialedNum.startsWith("+375") || dialedNum.startsWith("00375") || dialedNum.startsWith("011375")) {
        countryView.setImageResource(R.drawable.flag_blr);
        countryName.setText("Belarus");
    } //28
    else if (dialedNum.startsWith("+375") || dialedNum.startsWith("00375") || dialedNum.startsWith("011375")) {
        countryView.setImageResource(R.drawable.flag_blr);
        countryName.setText("Belarus");
    } //28
    else if (dialedNum.startsWith("+32") || dialedNum.startsWith("0032") || dialedNum.startsWith("01132")) {
        countryView.setImageResource(R.drawable.flag_bel);
        countryName.setText("Belgium");
    } //29
    else if (dialedNum.startsWith("+501") || dialedNum.startsWith("00501") || dialedNum.startsWith("011501")) {
        countryView.setImageResource(R.drawable.flag_biz);
        countryName.setText("Belize");
    } //30
    else if (dialedNum.startsWith("+229") || dialedNum.startsWith("00229") || dialedNum.startsWith("011229")) {
        countryView.setImageResource(R.drawable.flag_ben);
        countryName.setText("Benin");
    } //31
    else if (dialedNum.startsWith("+1441") || dialedNum.startsWith("001441")
            || dialedNum.startsWith("0111441")) {
        countryView.setImageResource(R.drawable.flag_ber);
        countryName.setText("Bermuda");
    } //32
    else if (dialedNum.startsWith("+975") || dialedNum.startsWith("00975") || dialedNum.startsWith("011975")) {
        countryView.setImageResource(R.drawable.flag_bhu);
        countryName.setText("Bhutan");
    } //33
    else if (dialedNum.startsWith("+591") || dialedNum.startsWith("00591") || dialedNum.startsWith("011591")) {
        countryView.setImageResource(R.drawable.flag_bol);
        countryName.setText("Bolivia");
    } //34
    else if (dialedNum.startsWith("+387") || dialedNum.startsWith("00387") || dialedNum.startsWith("011387")) {
        countryView.setImageResource(R.drawable.flag_bih);
        countryName.setText("Bosnia and Herzegovina");
    } //35
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //36
      ///////////////////////////////////////*******************************///////////////////////////////////////////////////////////////////////
    else if (dialedNum.startsWith("+55") || dialedNum.startsWith("0055") || dialedNum.startsWith("01155")) {
        countryView.setImageResource(R.drawable.flag_bra);
        countryName.setText("Brazil");
    } //37
    else if (dialedNum.startsWith("+673") || dialedNum.startsWith("00673") || dialedNum.startsWith("011673")) {
        countryView.setImageResource(R.drawable.flag_bru);
        countryName.setText("Brunei");
    } //38
    else if (dialedNum.startsWith("+359") || dialedNum.startsWith("00359") || dialedNum.startsWith("011359")) {
        countryView.setImageResource(R.drawable.flag_bul);
        countryName.setText("Bulgaria");
    } //39
    else if (dialedNum.startsWith("+226") || dialedNum.startsWith("00226") || dialedNum.startsWith("011226")) {
        countryView.setImageResource(R.drawable.flag_bur);
        countryName.setText("Burkina Faso");
    } //40
    else if (dialedNum.startsWith("+95") || dialedNum.startsWith("0095") || dialedNum.startsWith("01195")) {
        countryView.setImageResource(R.drawable.flag_mya);
        countryName.setText("Myanmar");
    } //41
    else if (dialedNum.startsWith("+257") || dialedNum.startsWith("00257") || dialedNum.startsWith("011257")) {
        countryView.setImageResource(R.drawable.flag_bdi);
        countryName.setText("Burundi");
    } //42
    else if (dialedNum.startsWith("+855") || dialedNum.startsWith("00855") || dialedNum.startsWith("011855")) {
        countryView.setImageResource(R.drawable.flag_cam);
        countryName.setText("Cambodia");
    } //43
    else if (dialedNum.startsWith("+237") || dialedNum.startsWith("00237") || dialedNum.startsWith("011237")) {
        countryView.setImageResource(R.drawable.flag_cmr);
        countryName.setText("Cameroon");
    } //44
    else if (dialedNum.startsWith("+238") || dialedNum.startsWith("00238") || dialedNum.startsWith("011238")) {
        countryView.setImageResource(R.drawable.flag_cpv);
        countryName.setText("Cape Verde");
    } //45
    else if (dialedNum.startsWith("+236") || dialedNum.startsWith("00236") || dialedNum.startsWith("011236")) {
        countryView.setImageResource(R.drawable.flag_caf);
        countryName.setText("CAR");
    } //46
    else if (dialedNum.startsWith("+235") || dialedNum.startsWith("00235") || dialedNum.startsWith("011235")) {
        countryView.setImageResource(R.drawable.flag_cha);
        countryName.setText("Chad");
    } //47
    else if (dialedNum.startsWith("+56") || dialedNum.startsWith("0056") || dialedNum.startsWith("01156")) {
        countryView.setImageResource(R.drawable.flag_chi);
        countryName.setText("Chile");
    } //48
    else if (dialedNum.startsWith("+86") || dialedNum.startsWith("0086") || dialedNum.startsWith("01186")) {
        countryView.setImageResource(R.drawable.flag_chn);
        countryName.setText("China");
    } //49
    else if (dialedNum.startsWith("+57") || dialedNum.startsWith("0057") || dialedNum.startsWith("01157")) {
        countryView.setImageResource(R.drawable.flag_col);
        countryName.setText("Colombia");
    } //50
    else if (dialedNum.startsWith("+269") || dialedNum.startsWith("00269") || dialedNum.startsWith("011269")) {
        countryView.setImageResource(R.drawable.flag_com);
        countryName.setText("Comoros");
    } //51
    else if (dialedNum.startsWith("+682") || dialedNum.startsWith("00682") || dialedNum.startsWith("011682")) {
        countryView.setImageResource(R.drawable.flag_cok);
        countryName.setText("Cook Islands");
    } //52
    else if (dialedNum.startsWith("+506") || dialedNum.startsWith("00506") || dialedNum.startsWith("011506")) {
        countryView.setImageResource(R.drawable.flag_crc);
        countryName.setText("Costa Rica");
    } //53
    else if (dialedNum.startsWith("+385") || dialedNum.startsWith("00385") || dialedNum.startsWith("011385")) {
        countryView.setImageResource(R.drawable.flag_cro);
        countryName.setText("Croatia");
    } //54
    else if (dialedNum.startsWith("+357") || dialedNum.startsWith("00357") || dialedNum.startsWith("011357")) {
        countryView.setImageResource(R.drawable.flag_cyp);
        countryName.setText("Cyprus");
    } //55
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //56
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //57
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //58
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //59
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //60
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //61
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //62
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //63
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //64
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //65
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //66
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //67
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //68
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //69
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //70
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //71
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //72
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //73
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //74
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //75
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //76
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //77
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //78
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //79
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //80
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //81
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //82
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //83
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //84
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //85
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //86
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //87
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //88
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //89
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //90
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //91
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //92
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //93
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //94
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //95
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //96
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //97
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //98
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //99
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //100
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //101
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //102
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //103
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //104
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //105
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //106
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //107
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //108
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //109
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //110
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //111
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //112
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //113
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //114
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //115
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //116
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //117
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //118
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //119
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //120
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //121
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //122
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //123
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //124
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //125
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //126
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //127
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //128
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //129
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //130
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //131
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //132
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //133
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //134
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //135
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //136
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //137
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //138
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //139
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //140
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //141
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //142
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //143
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //144
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //145
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //146
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //147
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //148
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //149
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //150
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //151
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //152
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //153
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //154
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //155
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //156
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //157
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //158
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //159
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //160
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //36
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //36
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //36
    else if (dialedNum.startsWith("+267") || dialedNum.startsWith("00267") || dialedNum.startsWith("011267")) {
        countryView.setImageResource(R.drawable.flag_bot);
        countryName.setText("Botswana");
    } //36
      ///////////////////////////////////////******************************//////////////////////////////////////////////////////////////////////
    else if ((dialedNum.length() >= 5 && dialedNum.startsWith("+1"))
            || (dialedNum.length() >= 6 && dialedNum.startsWith("001"))) {
        countryView.setImageResource(R.drawable.flag_usa);
        countryName.setText("USA");
    } //9
    else {
        countryView.setImageResource(0);
        countryName.setText("");
    }

    if (dialedNum.length() >= 6) {

    }
}

From source file:net.voxcorp.voxmobile.ui.dialpad.DialerFragment.java

private void placeCallWithOption(Bundle b) {
    if (service == null) {
        return;/* w  w  w  .  j a  v  a 2 s. co m*/
    }
    String toCall = "";
    Long accountToUse = SipProfile.INVALID_ID;
    // Find account to use
    SipProfile acc = accountChooserButton.getSelectedAccount();
    if (acc != null) {
        accountToUse = acc.id;
    }
    // Find number to dial
    if (isDigit) {
        toCall = PhoneNumberUtils.stripSeparators(digits.getText().toString());
    } else {
        toCall = digits.getText().toString();
    }

    if (TextUtils.isEmpty(toCall)) {
        return;
    }

    // Well we have now the fields, clear theses fields
    digits.getText().clear();

    // -- MAKE THE CALL --//
    if (accountToUse >= 0) {
        // It is a SIP account, try to call service for that
        try {
            service.makeCallWithOptions(toCall, accountToUse.intValue(), b);
        } catch (RemoteException e) {
            Log.e(THIS_FILE, "Service can't be called to make the call");
        }
    } else if (accountToUse != SipProfile.INVALID_ID) {
        // It's an external account, find correct external account
        CallHandlerPlugin ch = new CallHandlerPlugin(getActivity());
        ch.loadFrom(accountToUse, toCall, new OnLoadListener() {
            @Override
            public void onLoad(CallHandlerPlugin ch) {
                placePluginCall(ch);
            }
        });
    }
}

From source file:com.sip.pwc.sipphone.ui.dialpad.DialerFragment.java

private void placeCallWithOption(Bundle b) {
    if (service == null) {
        return;/*  w  w w  .j  a  v  a  2  s  .c o  m*/
    }
    String toCall = "";
    Long accountToUse = SipProfile.INVALID_ID;
    // Find account to use
    SipProfile acc = accountChooserButton.getSelectedAccount();
    if (acc == null) {
        return;
    }

    accountToUse = acc.id;
    // Find number to dial
    toCall = digits.getText().toString();
    if (isDigit) {
        toCall = PhoneNumberUtils.stripSeparators(toCall);
    }

    if (accountChooserFilterItem != null && accountChooserFilterItem.isChecked()) {
        toCall = rewriteNumber(toCall);
    }

    if (TextUtils.isEmpty(toCall)) {
        return;
    }

    // Well we have now the fields, clear theses fields
    digits.getText().clear();

    // -- MAKE THE CALL --//
    if (accountToUse >= 0) {
        // It is a SIP account, try to call service for that
        try {
            service.makeCallWithOptions(toCall, accountToUse.intValue(), b);
        } catch (RemoteException e) {
            Log.e(THIS_FILE, "Service can't be called to make the call");
        }
    } else if (accountToUse != SipProfile.INVALID_ID) {
        // It's an external account, find correct external account
        CallHandlerPlugin ch = new CallHandlerPlugin(getActivity());
        ch.loadFrom(accountToUse, toCall, new CallHandlerPlugin.OnLoadListener() {
            @Override
            public void onLoad(CallHandlerPlugin ch) {
                placePluginCall(ch);
            }
        });
    }
}