Package javax.microedition.pim

Examples of javax.microedition.pim.Contact


            while( e.hasMoreElements() ) {
                if( !isSorted && iElement == maxReturn ) {
                    break;
                }

                Contact c = (Contact) e.nextElement();
                ContactObject contact = new ContactObject( c );
                if( testable != null ) {
                    if( testable.test( contact ) ) {
                        FindNamespace.insertElementByOrder( found, contact, orderByField, isAscending );
                        iElement++;
View Full Code Here


            String viewArg = null;
            final ContactObject co = a.getContactObject();
            if( co != null ) {
                co.update();
            }
            Contact c = a.getContact();

            switch( view ) {
                case AddressBookArgumentsConstructor.VIEW_NEW:
                    if( c == null ) {
                        // Create a new contact
View Full Code Here

                    if( addressObject != null ) {
                        final String locality = addressObject.getItem( AddressObject.FIELD_CITY ).getStringValue();
                        final String region = addressObject.getItem( AddressObject.FIELD_STATE ).getStringValue();

                        if( locality.length() > 0 && region.length() > 0 ) {
                            Contact c;

                            // Create a new contact
                            try {
                                final ContactList contactList = (ContactList) PIM.getInstance().openPIMList( PIM.CONTACT_LIST,
                                        PIM.READ_WRITE );
                                c = contactList.createContact();
                            } catch( final PIMException e ) {
                                throw e;
                            }

                            final String[] addressHome = new String[ 7 ];
                            addressHome[ Contact.ADDR_STREET ] = addressObject.getItem( AddressObject.FIELD_ADDRESS1 )
                                    .getStringValue();
                            addressHome[ Contact.ADDR_LOCALITY ] = addressObject.getItem( AddressObject.FIELD_CITY )
                                    .getStringValue();
                            addressHome[ Contact.ADDR_REGION ] = addressObject.getItem( AddressObject.FIELD_STATE )
                                    .getStringValue();
                            addressHome[ Contact.ADDR_POSTALCODE ] = addressObject.getItem( AddressObject.FIELD_ZIP )
                                    .getStringValue();
                            addressHome[ Contact.ADDR_COUNTRY ] = addressObject.getItem( AddressObject.FIELD_COUNTRY )
                                    .getStringValue();
                            addressHome[ Contact.ADDR_EXTRA ] = addressObject.getItem( AddressObject.FIELD_ADDRESS2 )
                                    .getStringValue();

                            c.addStringArray( Contact.ADDR, Contact.ATTR_HOME, addressHome );
                            args = new MapsArguments( c, 0 );
                        } else {
                            throw new IllegalArgumentException( "Address should contain 'city' and 'state' information!" );
                        }
                    } else {
View Full Code Here

    }


    private void getNumFromPIMBrowser()
    {
        Contact pimContact = (Contact) pimBrowser.getSelectedItem();
        String pimName = pimContact.getString(Contact.FORMATTED_NAME, 0);
        String pimNumber = pimContact.getString(Contact.TEL, 0);
        next.setContacting(pimNumber, pimName);
        try {
            settings.addContact(new KeyValuePair(pimNumber, pimName));
        } catch (RecordStoreException ex) {
            Logger.add(getClass().getName(), "getNumFromPIMBrowser", ex.getMessage());
View Full Code Here

    }


    private void getNumFromPIMBrowser()
    {
        Contact pimContact = (Contact) pimBrowser.getSelectedItem();
        String pimName = pimContact.getString(Contact.FORMATTED_NAME, 0);
        String pimNumber = pimContact.getString(Contact.TEL, 0);
        next.setContacting(pimNumber, pimName);
        try {
            settings.addContact(new KeyValuePair(pimNumber, pimName));
        } catch (RecordStoreException ex) {
            Logger.add(getClass().getName(), "getNumFromPIMBrowser", ex.getMessage());
View Full Code Here

        try {
            _contactList =
                    (ContactList) PIM.getInstance().openPIMList(
                            PIM.CONTACT_LIST, PIM.READ_ONLY);

            final Contact hasEmail = _contactList.createContact();
            hasEmail.addString(Contact.ORG, PIMItem.ATTR_NONE, "");
            hasEmail.addString(Contact.EMAIL, Contact.ATTR_HOME, "");

            final Enumeration contactsWithEmail = _contactList.items();
            _contacts = enumToVector(contactsWithEmail);

            if (!_contacts.isEmpty()) {
View Full Code Here

     * @see net.rim.device.api.ui.component.ListFieldCallback#drawListRow(ListField,Graphics,int,int,int)
     */
    public void drawListRow(final ListField listField, final Graphics graphics,
            final int index, final int y, final int width) {
        if (listField == _listField && index < _contacts.size()) {
            final Contact item = (Contact) _contacts.elementAt(index);
            final String displayName = PIMDemo.getDisplayName(item);
            graphics.drawText(displayName, 0, y, 0, width);
        }
    }
View Full Code Here

                    final Object context) {
                _contactListScreen = new ContactListScreen();
                UiApplication.getUiApplication().pushModalScreen(
                        _contactListScreen);

                Contact contact;
                // Get selected contact from contact list.
                if ((contact = _contactListScreen.getSelectedContact()) != null) {
                    final String name = PIMDemo.getDisplayName(contact);

                    final EditField newField =
View Full Code Here

            // Save the contact.
            try {
                final ContactList contactList =
                        (ContactList) PIM.getInstance().openPIMList(
                                PIM.CONTACT_LIST, PIM.WRITE_ONLY);
                final Contact contact = contactList.createContact();
                final String[] name =
                        new String[contactList.stringArraySize(Contact.NAME)];

                /*
                 * This section adds values to selective PIM items. Additional
                 * items can be added for Contact or BlackBerryContact fields.
                 * Please refer to javadocs.
                 */
                if (firstName.length() != 0) {
                    name[Contact.NAME_GIVEN] = firstName;
                }

                if (lastName.length() != 0) {
                    name[Contact.NAME_FAMILY] = lastName;
                }

                contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name);

                if (home.length() != 0) {
                    contact.addString(Contact.TEL, Contact.ATTR_HOME, home);
                }

                if (home2.length() != 0) {
                    contact.addString(Contact.TEL,
                            BlackBerryContact.ATTR_HOME2, home2);
                }

                if (email.length() != 0) {
                    // Perform email validation here.
                    contact.addString(Contact.EMAIL, Contact.ATTR_HOME, email);
                }

                // Persist data to contact list.
                contact.commit();

                // Instruct caller to return to contact list.
                return true;
            } catch (final PIMException e) {
                PIMDemo.errorDialog(e.toString());
View Full Code Here

                sb.append(name);
                sb.append(']');

                delayedFields.addElement(new RichTextField(sb.toString()));
            } else if (bodyPart instanceof PDAPContactAttachmentPart) {
                final Contact contact = (Contact) bodyPart.getContent();

                // Build the contact name
                final StringBuffer sb = new StringBuffer("Contact: ");
                if (contact.countValues(Contact.NAME) > 0) {
                    final String[] name =
                            contact.getStringArray(Contact.NAME, 0);

                    if (name[Contact.NAME_PREFIX] != null) {
                        sb.append(name[Contact.NAME_PREFIX]);
                        sb.append(' ');
                    }
View Full Code Here

TOP

Related Classes of javax.microedition.pim.Contact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.