1

When I try the code belowe it blocks the UI thread(I think) it loads a blank page. Can some one please tell me what is the correct way to implement handleNavigationRequest. I tried implementing it but when I tried to run I get an error that handleNavigationRequest must be an Interface.

heres the code

class BrowserFieldScreen extends MainScreen 
    {  
        public BrowserFieldScreen()

        {   
            BrowserFieldConfig browserFieldConfig = new BrowserFC();
            BrowserFieldListener browserFieldListener = new BrowserFL();                
            BrowserField browserField = new BrowserField(browserFieldConfig);
            browserField.addListener(browserFieldListener);         
            ProtocolController controller = new ProtocolController(browserField) {
                public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {


                   }
                };
            browserField.getConfig().setProperty(BrowserFieldConfig.CONTROLLER, controller);
            browserField.requestContent("http://meul-online.com");
            super.add(browserField);
        }
Maikel Bollemeijer
  • 6,545
  • 5
  • 25
  • 48

1 Answers1

4

The problem is you are requesting the page but not displaying it .

try this

    /**
 * Handle navigation requests (e.g., link clicks)
 */
public void handleNavigationRequest(final BrowserFieldRequest request) throws Exception {
    try {
        final InputConnection ic = handleResourceRequest(request);
        UiApplication.getUiApplication().invokeLater(new Runnable() {

            public void run() {
                browserField.setFocus();
                browserField.displayContent(ic, request.getURL());  
            }
        });
    } catch (Exception e) { 
        Log.Error(e, "handleNavigationRequest");
    }

}
rfsk2010
  • 8,571
  • 4
  • 32
  • 46