Help Center

Local Navigation

Code sample: Displaying available transport types

* Research In Motion Limited proprietary and confidential
* Copyright Research In Motion Limited, 2009
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import java.lang.StringBuffer;

public class DisplayAvailableTransportTypes extends UiApplication
   public static RichTextField _message = new RichTextField("");
public static void main(String[] args)
    DisplayAvailableTransportTypes theApp = new DisplayAvailableTransportTypes();
public DisplayAvailableTransportTypes()

    pushScreen(new DisplayAvailableTransportTypesScreen());


class DisplayAvailableTransportTypesScreen extends MainScreen
    private RichTextField strMessage = new RichTextField("");

    public DisplayAvailableTransportTypesScreen()
        LabelField title = new LabelField("Transport Types Sample",
        LabelField.ELLIPSIS |
        add(new RichTextField("Detected the following transport types:\n"));
            int TransportTypes[] = TransportInfo.getAvailableTransportTypes();
            StringBuffer sbTmp = new StringBuffer("");
            for(int i=0; i<TransportTypes.length; i++)
                int tt = TransportTypes[i];
                    case TransportInfo.TRANSPORT_BIS_B:          
																							sbTmp.append(" BIS-B\n"); break;
                    case TransportInfo.TRANSPORT_MDS:            
																							sbTmp.append("* MDS\n");  break;
                    case TransportInfo.TRANSPORT_TCP_CELLULAR:   
																							sbTmp.append("* TCP Cellular\n"); break;
                    case TransportInfo.TRANSPORT_TCP_WIFI:       
																							sbTmp.append("* Wifi\n"); break;
                    case TransportInfo.TRANSPORT_WAP:            
																							sbTmp.append("* WAP 1.0 or 1.1\n"); break;
                    case TransportInfo.TRANSPORT_WAP2:           
																							sbTmp.append("* WAP 2.0\n"); break;

Previous topic: Enhanced Network API

Was this information helpful? Send us your comments.