Retrieve a mobile Contact number

Hello everyone and happy new year. I created an EditField I want that the user can click to open the Contacts application, then when a contact is display selected mobile numbers available and lets the user select a. I have done with the e-mail addresses of the Contacts but can't bring back their mobile numbers. I get an argument exception non-compliant when I click on the field to start contacts about below is my code which is just a modified version of the code that I used to retrieve the email addresses:

public void getContact() {}
PIM pim = PIM.getInstance ();
Try
{
BlackBerryContactList = contacts
(BlackBerryContactList) pim.openPIMList (PIM. CONTACT_LIST,
PIM. READ_WRITE);
Selected BlackBerryContact = contacts (BlackBerryContact).
Choose();
If (selected! = null)
{
int mobileNumCount = selected.countValues (Contact.ATTR_MOBILE);
Check that there is a for this contact's mobile number.
If (mobileNumCount > 0)
{
String selectedMobile;
If there is more than a mobile display, a dialog box choose
If (mobileNumCount > 1)
{
String address [] = new String [mobileNumCount];
int [] values = new int [mobileNumCount];
for (int i = 0; i)< mobilenumcount;="">
{
Addresses [i] = selected.getString (Contact.ATTR_MOBILE, i);
Values [i] = i;
}
Dlg = new dialog box dialog box (menu "Select which number to use.", ")
Addresses, values 0.
Bitmap.getPredefinedBitmap (Bitmap.QUESTION));
int selectedAddr = dlg.doModal ();
selectedMobile = addresses [selectedAddr];
}
on the other
{
selectedMobile = selected.getString (Contact.ATTR_MOBILE, 0);
}
Reference DeclarationScreen =
(DeclarationScreen) UiApplication.getUiApplication)
. getActiveScreen();
theScreen.phoneNum.setText (selectedMobile);
}
}
}
{} catch (PIMException e)
e.printStackTrace ();
}
}

Solved. My problem was that I put a listener of changes on my EditField and it overrode keyChar to this field, so when I ran the getContactMethod the fieldChanged() and the keyChar method were contradictory. I just deleted from fieldChanged().

Tags: BlackBerry Developers

Similar Questions

  • BlackBerry Z10 writing new Messages - Contacts combines a Mobile phone number, home

    When I chose to compose a text Message and select by a Contact who has multiple phone numbers stored, the phone selects the telephone number of the Contact homepage default rather than their Mobile phone number. I'm doing something wrong?

    I did a little experiment, created a group with 1 contact, send a text message to the group, sms went to the house number.

    I deleted then house number (which was at the top of the list) then added a new home field. After that the number of publishing house has yet shown on the top of the list, but sms now went to the Mobile number.

  • Problem in getting number of Mobile Contact list

    Hello

    I write the code for the number of cell phone contacts list. But if there are two number (phone number, mobile phone number) in a single contact, then I'm unable and differentiate.

    BlackBerryContactList contacts = null;
            try {
                PIM pim = PIM.getInstance();
                contacts = (BlackBerryContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
                PIMItem item = contacts.choose();
                if (item == null || !(item instanceof Contact)) {
                    return;
                }
    
    BlackBerryContact contact = (BlackBerryContact) item;
    
                int nTelNoCount = contact.countValues(BlackBerryContact.TEL);
    
                for (int i = 0; i < nTelNoCount; ++i)
    
                {
    
                    int telAttrs = contact.getAttributes(BlackBerryContact.TEL, i);
    
                    if ((telAttrs & BlackBerryContact.TEL) != 0 || contacts.isSupportedField(BlackBerryContact.ATTR_MOBILE)) {
    
                        String str;
                        Logger.out(m_strClassName,"---------3");
                        str = textbox.getText().trim();
                        if (str.equals(""))
    
                        {
    
                            String strMob = contact.getString(BlackBerryContact.TEL, i).trim();
    
                            Logger.out("InviteFriendScreen", "----------------strMo" + strMob + "--len--" + strMob.length() + "---" + strMob);
    
                            textbox.setText(strMob);
    
                        }
    
                        else if (str.indexOf((contact.getString(BlackBerryContact.TEL, i))) != -1)
    
                        {
    
                            Dialog.alert(Constants.ALERT_ENTER_DIFFERENT_NUMBER);
    
                        }
                        else
    
                        {
                            String addContact = contact.getString(BlackBerryContact.TEL, i);
                            Logger.out(m_strClassName,"---------4");
                            if (str.indexOf(addContact) == -1)
    
                            {
                                Logger.out(m_strClassName,"---------5");
                                textbox.setText(str + "," + addContact);
                            }
                        }
    
                        break;
    
    //              } else {
    //
    //                  Dialog.alert(Constants.ALERT_ADD_ONLY_MOBILE_NUMBER);
                    }
    
                }
    
            }
            catch (PIMException e)
            {
    
            }
            try
    
            {
                Logger.out(m_strClassName,"---------7");
                contacts.close();
    
            }
    
            catch (PIMException e)
    
            {
                Logger.out(m_strClassName,"---------8");
                e.printStackTrace();
    
            }
        }
    

    Now here when I added only the contact number of work and is not added and showing an alert (add only Mobile number). But if a person has mobile number and contact number of work, then that's all first showing the alert and then adding the mobile number.

    How can I solve this problem?

    Yes, I solve it...

  • How to get the contact's mobile phone number?

    I know there is StringArray for data http://www.blackberry.com/developers/docs/4.6.0api/index.html telphone and I see someone [contact.getString (Contact.TEL, 0)] to obtain the HOUSE telphone number. From my point of view, it should be Contact.Tel [N] above. So my question is how do I get the mobile phone number? Can I use contact.getString (xxx)? Thanks for any response.

    VR;

    getString (Contact.TEL, Contact.ATTR_MOBILE)

    instead of 0 as the 2nd argument

  • How to read the mobile contacts?

    Hi all

    I want to read the mobile contacts and I want to show the contacts through my application.

    How to get there?

    Kind regards

    Naresh T

    It comes from my (very) chopped together solution;

    QString App::getContactsList(){
        ContactListFilters filters;
        QString contactListString;
        int contactListCount;
        int i;
        int x;
    
        filters.setHasAttribute(AttributeKind::Phone);
        filters.setLimit(9999);
        QList contactList = ContactService().contacts(filters);
        QList phoneNumberList;
        contactListCount = contactList.count();
    
        qDebug() << "Found " << contactListCount << " contacts";
        for(i=0; i < contactListCount; i++){
            contactListString += "[CONTACT]" + contactList[i].sortFirstName() + "[FNAME]" + contactList[i].sortLastName() + "[LNAME]";
            phoneNumberList = contactList[i].phoneNumbers();
            qDebug() << "Phone Number Count: " << phoneNumberList.count();
    
            for(x=0; x < phoneNumberList.count(); x++){
                contactListString += phoneNumberList[x].value().toAscii() + "[ENDNO]";
            }
            contactListString += "[ENDCONTACT]";
        }
    
        qDebug() << contactListString;
    
        return contactListString;
    }
    
  • APP-BY-74450 mobile phone number is not valid.  Its length must be between 10

    Hello

    We have upgraded 12.0.4 for 12.1.3.

    After upgrade during the trials of HR,
    Contact number for the employee does not special
    characters such as ' + '.

    Error message indicating

    "APP-BY-74450 mobile number is invalid. Its length must be between 10 ".

    Thank you

    Error message indicating

    "APP-BY-74450 mobile number is invalid. Its length must be between 10 ".

    Please see ("party is not found.") Select a valid part "error creating candidate with bad phone. [(ID 1374469.1) number]"

    Thank you
    Hussein

  • Mobile phone number Skype UK

    I have a landline to Skype's UK... starting with 020 number...

    Skype offers a UK mobile phone number, beginning with 070... ?

    bettyinuk wrote:


    Skype offers a UK mobile phone number, beginning with 070... ?

    Sorry - all Skype are landline numbers.

    TIME ZONE - US EAST. LOCATION - PHILADELPHIA, PA, USA.

    I recommend that you always run the latest version of Skype: Windows & Mac

    If my advice helped to solve your problem, please mark it as a solution to help others.
    Please note that I usually do not respond to unsolicited private Messages. Thank you.

  • How do you get a contact number or an e-mail address MSN Hotmail in Microsoft in Australia?

    Original title: Hotmail for the security update.

    How can you get an address or a contact number for MSN Hotmail account under Microsoft in Australia?

    Problem: I posted a spam problem on my Hotmail account.
    MSN; Sent a new code to reset my account.
    Problem: Contactable email address wasn't updated and codes have been sent to a non-existent e-mail address.
    Cannot activate this account for my msn which has years of details inside. MSN-Hotmail interest says it's
    Microsoft America property. And cannot sat.
    Anthony EGAN

    Hi Eleonora_maria,

    I recommend you ask your question in the support forum for Windows Live Hotmail for assistance.

    http://www.windowslivehelp.com/forums.aspx?ProductID=1


    Reference:
    Windows Live Hotmail Top issues and Support information

    Hope the helps of information.

  • I don't have my key code for windows. My dealer doesn't have either. How can I retrieve the key code number?

    I don't have my key code for windows (registration card was not with the computer when I bought it).  My carrier apparently deleted the key during my computer repair code.  My retailer where I purchased the computer didn't either.  How can I retrieve my key code number?

    The Windows product key is usually displayed on the sticker on the underside of the computer.

    However, you can also get it by running the Belarc Advisor or the Magic Jellybean Key Finder.

    Google for one of those and you will find them.

  • Contacts group Q10 blackBerry in 10.2.1 containing phone numbers fixed rather than mobile phone number

    I now have Contacts of the group in 10.2.1 update for Q10, but when I go to send a text message to the group he picks up the fixed contacts phone numbers rather than their mobile numbers. Can someone advise please? Thank you

    set up contacts group & save.  Once this is done, go to each Member of the group, touch & hold, it will turn blue & give you a small box on the right side, with 2 black boxes, a white box & a tick.

    Press this button, it will open up «ways to connect»

    just ubtick or ICT the preferred method.

    Or that's how it works on mine...

  • Is is possible to retrieve a deleted phone number?

    I have an iPhone 6s, and I just got a robocall.  Without thinking, I deleted the number. Is it possible to retrieve this number? This number isn't in my contacts. This number never received before.

    I am afraid that you cannot retrieve this number if you don't him had not saved on your contacts.

  • How can I change a default contact number to send messages

    Some of my contacts have more than 1 number of cells. In the new IOS, the first time I click on the "Send message" icon, he asked me what number I want to send your message. Next time, it will automatically use the number I chose. But if I chose the wrong number, I can't find a way to reset, and then select a new number of 'send nessage' by default.

    I thought about it. Open the contact, make a pressure farm (3D touch) click the 'send message '. It opens a menu where you can select the default number.

  • Contact number of Toshiba in Germany customer service

    Could someone knows the number of customer contact for care in Germany. In the affirmative, please let me know as I am facing a problem with my laptop toshiba Satellite P15-S479

    Thank you best regards n,.
    Rahul.

    Hello

    It's the Toshiba Infoline for the Germany
    0049 180 522 42 40

    They can tell you what number do you need for your problem!

    Good bye

  • Mobile Skype number transferred abroad

    Hello

    I'm in Australia. I'm going to Canada for two weeks to work and will have a mobile phone (cell phone) Candian while I'm there.

    Can I get a Skype number in interest and have my calls transferred to the Canadian mobile number?

    JoeyAfros wrote:

    Get a Skype number in interest and have my calls transferred to the Canadian mobile number?

    Hello

    Yes you can.

    You will need an Australian Skype number and (b) an unlimited subscription to USA/Canada @$2.99 / month or a little Skype credit to finance the cost of calls transferred.

    TIME ZONE - US EAST. LOCATION - PHILADELPHIA, PA, USA.

    I recommend that you always run the latest version of Skype: Windows & Mac

    If my advice helped to solve your problem, please mark it as a solution to help others.
    Please note that I usually do not respond to unsolicited private Messages. Thank you.

  • Mobile phone number has been selected to the annual price of Microsoft. Is this true?

    I received a message that my mobile number is selected based on annual price microsoft & Rs.1000000, I won .the reference is given flecter james from the United Kingdom is this true

    Original title: urgent request

    No, it is not true.  Read this response:

Maybe you are looking for