Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6004511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:16:24+00:00 2026-05-23T01:16:24+00:00

I’m trying to make an embedded web page on my blackberry app, and I’m

  • 0

I’m trying to make an embedded web page on my blackberry app, and I’m having trouble setting the starting URL.

I can only set the URL when I do it from a callback from a TextField. When I try to do it after I push the new screen on, the app no longer works (it does nothing when you try to run it.

The code that works is the following:

protected boolean keyChar(char key, int status, int time) 
{
    if ( key == Characters.ENTER ) 
    {
        Application.getApplication().invokeLater( new Runnable() 
            {
                public void run() {                     
                    //progressBar.reset("", 0, 100, 0);
                    browserField.requestContent(locationBar.getText().trim());
                } 
            });
        return true;
    } 
    return super.keyChar(key, status, time);
}

When I try to set it automatically after everything is created, nothing happens when I run the app.

Code snippet

public MyApp() 
{
    pushScreen(new BrowserFieldScreen());

    // if I have this here, the app will not open
    Application.getApplication().invokeLater( new Runnable() 
        {
            public void run() {                     
                gBrowserField.requestContent("http://google.com");
            } 
    });
}

The complete program:

package mypackage;

import java.util.Enumeration;
import java.util.Hashtable;

import net.rim.device.api.browser.field.ContentReadEvent;
import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.browser.field2.BrowserFieldListener;
import net.rim.device.api.system.Application;
import net.rim.device.api.system.Characters;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.GaugeField;
import net.rim.device.api.ui.component.TextField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.BackgroundFactory;

import org.w3c.dom.Document;  

/**
 * BrowserField2ProgressTracker
 * - A BrowserField2 Mini-browser application that keeps track of page-loading progress
 *   and displays progress information to the user.
 */

public class MyApp extends UiApplication {


    static BrowserField gBrowserField;
    public static void main(String[] args){
        MyApp theApp = new MyApp();
        theApp.enterEventDispatcher();
    } 

    public MyApp() {
        pushScreen(new BrowserFieldScreen());
    /*  
        if I have this hear, the ap will not open
        Application.getApplication().invokeLater( new Runnable() {
            public void run() {                     
                gBrowserField.requestContent("http://google.com");
            } 
        });
    }
    */
}

/**
 * BrowserFieldScreen
 * - A screen that contains a location bar, a progress bar, and a browser field
 */
class BrowserFieldScreen extends MainScreen {

    // The location bar where URL will be typed in
    private TextField locationBar;  


    // The BrowserField 
    private BrowserField browserField;


    public BrowserFieldScreen() {
//      progressTracker = new BrowserFieldLoadProgressTracker(10f);
        createGUI();


    }

    private void createGUI() {

        VerticalFieldManager mainManager = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT | Manager.VERTICAL_SCROLLBAR | Manager.HORIZONTAL_SCROLLBAR );

        locationBar = new TextField() {

            protected boolean keyChar(char key, int status, int time) {
                if ( key == Characters.ENTER ) {
                    Application.getApplication().invokeLater( new Runnable() {
                        public void run() {                     
                            //progressBar.reset("", 0, 100, 0);
                            browserField.requestContent(locationBar.getText().trim());
                        } 
                    });
                    return true;
                } 
                return super.keyChar(key, status, time);
            } 
        };

        locationBar.setBackground(BackgroundFactory.createSolidBackground(Color.BEIGE));
        locationBar.setText("http://google.com");
        browserField = new BrowserField();

        MyApp.gBrowserField=browserField;
        mainManager.add(locationBar);
        mainManager.add(browserField);
        add(mainManager);   
    } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:16:25+00:00Added an answer on May 23, 2026 at 1:16 am

    I don’t think you can call invokeLater() until your app, theApp has enter the main event thread. Which is done by calling theApp.enterEventDispatcher()

    instead try changing your BrowserFieldScreen constructor to:

    public BrowserFieldScreen() {
        //      progressTracker = new BrowserFieldLoadProgressTracker(10f);
        createGUI();
        browserField.requestContent("http://google.com");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make an embedded Linux for a SuperH processor board. I
I've been trying to make GNU gdb 6.5-14 to use the source code embedded
I am fairly new to iOS development and trying make a simple app which
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a small countdown timer in my app but it's not working.
Hey trying to make a fancy little app here in VB.NET framework 4. I've
I'm trying to make a ad-hoc beta distribution of my app, but get this
Just to summarize, I'm trying to make a live page render (browse websites) while
I'm playing whack-a-mole trying to make an embedded video file work on all major
I'm trying to make my app choose the GPS provider. Method getBestProvider() yields the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.