Package net.rim.blackberry.api.invoke

Examples of net.rim.blackberry.api.invoke.AddressBookArguments


        fs.addNullableParam( Object.class, false );
        return new FunctionSignature[] { fs };
    }

    private void invokeAddressBook( final Object arg ) throws Exception {
        AddressBookArguments args = null;

        if( arg instanceof AddressBookArgumentsObject ) {
            final AddressBookArgumentsObject a = (AddressBookArgumentsObject) arg;

            final int view = a.getView();
            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
                        try {
                            final ContactList contactList = (ContactList) PIM.getInstance().openPIMList( PIM.CONTACT_LIST,
                                    PIM.READ_WRITE );
                            c = contactList.createContact();
                        } catch( final PIMException e ) {
                            throw e;
                        }
                    }
                    viewArg = AddressBookArguments.ARG_NEW;
                    break;
                case AddressBookArgumentsConstructor.VIEW_COMPOSE:
                    viewArg = AddressBookArguments.ARG_COMPOSE;
                    break;
                case AddressBookArgumentsConstructor.VIEW_DISPLAY:
                    viewArg = AddressBookArguments.ARG_VIEW;
                    break;
                default:
                    throw new IllegalArgumentException();
            }

            if( c == null ) {
                args = new AddressBookArguments( viewArg );
            } else {
                args = new AddressBookArguments( viewArg, c );
            }
        } else {
            args = new AddressBookArguments();
        }

        Invoke.invokeApplication( Invoke.APP_TYPE_ADDRESSBOOK, args );
    }
View Full Code Here


        nameArray[Contact.NAME_FAMILY] = names[1];
        nameArray[Contact.NAME_GIVEN] = names[0];
        contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, nameArray);

        // Invoke the Adress Book application
        final AddressBookArguments abArg =
                new AddressBookArguments(AddressBookArguments.ARG_NEW, contact);
        Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBOOK, abArg);

        try {
            // Commit changes to the contact model
            contact.commit();
View Full Code Here

TOP

Related Classes of net.rim.blackberry.api.invoke.AddressBookArguments

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.