Package net.rim.device.api.servicebook

Examples of net.rim.device.api.servicebook.ServiceRouting


        // Create the MainScreen and add the appropriate UI fields.
        _screen = new MainScreen();
        _screen.setTitle("Service Routing Demo");

        final ServiceRouting sr = ServiceRouting.getInstance();
        sr.addListener(this);
        _statusField =
                new RichTextField(
                        sr.isSerialBypassActive() ? "Serial Bypass: Connected"
                                : "Serial Bypass: Disconnected");
        _screen.add(_statusField);

        _treeField = new TreeField(this, Field.FOCUSABLE);
        _treeField.setEmptyString("* No Service Records *", 0);
View Full Code Here


    private void showServices() {
        // Remove all of the items from the listField.
        _treeField.deleteAll();

        // Get a copy of the ServiceRouting class.
        final ServiceRouting serviceRouting = ServiceRouting.getInstance();

        // Add in our new items by trolling through the ServiceBook API.
        final ServiceBook sb = ServiceBook.getSB();
        final ServiceRecord[] records = sb.getRecords();

        if (records == null) {
            return;
        }

        final int rootNode = _treeField.addChildNode(0, "Service Records");

        final int numRecords = records.length;

        for (int i = 0; i < numRecords; i++) {
            final String name = records[i].getName();
            String description = records[i].getDescription();

            if (description == null || description.length() == 0) {
                description = "No description available";
            }

            final String uid = records[i].getUid();
            final boolean serialBypass =
                    serviceRouting.isSerialBypassActive(uid);

            final int newParentNode = _treeField.addChildNode(rootNode, name);
            _treeField.addChildNode(newParentNode, description);
            _treeField.addChildNode(newParentNode, uid);
            _treeField.addChildNode(newParentNode,
View Full Code Here

TOP

Related Classes of net.rim.device.api.servicebook.ServiceRouting

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.