Tuesday, March 1, 2011

BlackBerry - read custom ringtone name from address book contact list?

Actually I am assigning custom ringtone with contact number in a custom database contact list. Now I am having problem with the reading to that contact list. If anyone having any idea about this problem pls pls help.

UPDATE

public void showAddressBook() {
    try {
        ContactList contactList = (ContactList) PIM.getInstance()
                .openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
        Enumeration enumx = contactList.items();
        while (enumx.hasMoreElements()) {
            Contact c = (Contact) enumx.nextElement();
            int[] fieldIds = c.getFields();
            System.out.println("SHOW:" + c.EXTENDED_FIELD_MIN_VALUE);
            int id;
            for (int index = 0; index < fieldIds.length; ++index) {
                id = fieldIds[index];
                System.out.println(c.getPIMList().getFieldLabel(id)
                        + "==showAddressBook==" + fieldIds.length);
                if (c.getPIMList().getFieldDataType(id) == Contact.STRING) {
                    for (int j = 0; j < c.countValues(id); ++j) {
                        String value = c.getString(id, j);
                        System.out.println(c.getPIMList().getFieldLabel(id)
                                + "=" + value);
                    }
                }
            }
        }
    } catch (PIMException ex) {
        ex.printStackTrace();
    }
}
From stackoverflow

0 comments:

Post a Comment