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 7617933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:16:09+00:00 2026-05-31T03:16:09+00:00

I’m struggling with the BrowserField . I would like a screen with a BrowserField

  • 0

I’m struggling with the BrowserField. I would like a screen with a BrowserField at the top, and one at the bottom. I would like to point each one to a URL containing an image (and maybe HTML) – kind of how one might see an AdMob advert.

So I want to define a custom size for the BrowserField. Can that be done?

  • At the moment, the BrowserField is taking up the whole screen. (* see update below)
  • I have tried to subclass it anonymously – but it is final.

Is this a possible use case, or should I look for a different solution to the problem altogether…?


Update:

I have placed the BrowserField within a VerticalFieldManager and sized that accordingly (as per Blackberry BrowserField does not fit to screen).

(re-edit: this was the right idea, but I had made a mistake in my code that made me think it was still broken. Accepted answer below provides perfect code to accomplish exactly what I was hoping for.)

  • 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-31T03:16:10+00:00Added an answer on May 31, 2026 at 3:16 am

    I’ve layouted two BrowserFields. One is aligned to top, the other is aligned to bottom. Their height is defined by TOP_BROWSER_FIELD_HEIGHT and BOTTOM_BROWSER_FIELD_HEIGHT accordingly. In the middle there is another manager that consume all the available height that is left after layouting the BrowserFields.

    import net.rim.device.api.browser.field2.BrowserField;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class BrowserFieldScreen extends MainScreen implements FieldChangeListener {
        private static final int TOP_BROWSER_FIELD_HEIGHT = Display.getHeight() / 3;
        private static final int BOTTOM_BROWSER_FIELD_HEIGHT = Display.getHeight() / 3;
    
        private BrowserField topBrowserField;
        private BrowserField bottomBrowserField;
        private VerticalFieldManager vfmCenter;
        private ButtonField startButton;
    
        public BrowserFieldScreen() {
            super(NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL | USE_ALL_WIDTH | USE_ALL_HEIGHT);
    
            final VerticalFieldManager topVfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH);
            topBrowserField = new BrowserField();
            topVfm.add(topBrowserField);
    
            final VerticalFieldManager bottomVfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH);
            bottomBrowserField = new BrowserField();
            bottomVfm.add(bottomBrowserField);
    
            vfmCenter = new VerticalFieldManager(USE_ALL_WIDTH);       
            vfmCenter.setBackground(BackgroundFactory.createSolidBackground(Color.GRAY));
            HorizontalFieldManager hfmCenter = new HorizontalFieldManager(USE_ALL_HEIGHT | FIELD_HCENTER);
            startButton = new ButtonField("START", FIELD_VCENTER);
            startButton.setChangeListener(this);
            hfmCenter.add(startButton);
            vfmCenter.add(hfmCenter);
    
            VerticalFieldManager vfm = new VerticalFieldManager() {
                protected void sublayout(int maxWidth, int maxHeight) {
                    setExtent(maxWidth, maxHeight);
    
                    // layout BrowserFields first
                    layoutChild(topVfm, maxWidth, TOP_BROWSER_FIELD_HEIGHT);
                    layoutChild(bottomVfm, maxWidth, BOTTOM_BROWSER_FIELD_HEIGHT);
    
                    // layout center field manager last to make it occupy all the height left
                    int maxCenterHeight = maxHeight - (TOP_BROWSER_FIELD_HEIGHT + BOTTOM_BROWSER_FIELD_HEIGHT);
                    layoutChild(vfmCenter, maxWidth, maxCenterHeight);
    
                    int yPos = 0;
                    setPositionChild(topVfm, 0, yPos);
                    yPos += TOP_BROWSER_FIELD_HEIGHT;
                    setPositionChild(vfmCenter, 0, yPos);
                    yPos += vfmCenter.getHeight();
                    setPositionChild(bottomVfm, 0, yPos);
                };
            };
    
            vfm.add(topVfm);
            vfm.add(vfmCenter);
            vfm.add(bottomVfm);
            add(vfm);
        }
    
        public void fieldChanged(Field field, int context) {
            if (field == startButton) {
                topBrowserField.requestContent("http://www.google.com");
                bottomBrowserField.requestContent("http://www.yahoo.com");
            }
        }
    }
    

    The result is
    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.