Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 144
Registered: ‎12-20-2008
My Device: Not Specified

Source File part 1

 ConexionHTTP.java
package com.rim.samples.device.ElRecreo;

 

final public class ConexionHTTP extends UiApplication implements RenderingApplication
{   
    private static final String REFERER = "referer";  
   
    private BrowserContentManager _browserContentManager;
    private HttpConnection  _currentConnection;      
    private MainScreen _mainScreen;
     
    public static void main(String[] args)
    {
        ConexionHTTP app = new ConexionHTTP();
        app.enterEventDispatcher();
    }
    
   
     Public ConexionHTTP()
     {              
        _browserContentManager = new BrowserContentManager( 0 );
        RenderingOptions renderingOptions = _browserContentManager.getRenderingSession().getRenderingOptions();

      renderingOptions.setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.SHOW_IMAGES_IN_HTML, false);
       
        _mainScreen = new MainScreen();
        _mainScreen.add(new LabelField("Label before the content", Field.FOCUSABLE));
             
        _mainScreen.add(_browserContentManager);
       
        _mainScreen.add(new LabelField("Label after the content", Field.FOCUSABLE));               
        pushScreen(_mainScreen);
               
        PrimaryResourceFetchThread thread = new PrimaryResourceFetchThread("http://www.coopelrecreo.com", null, null, null, this);
        thread.start(); 
    }
   
     void processConnection(HttpConnection connection, Event e)
     {              
         // Cancel previous request.
         if (_currentConnection != null)
         {
             try
             {
                 _currentConnection.close();
             }
             catch (IOException e1)
             {
             }
         }
        
         _currentConnection = connection;
        
        try
        {
            _browserContentManager.setContent(connection, this, e);
        }
        finally
        {
            SecondaryResourceFetchThread.doneAddingImages();
        }
    }