If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Contributor
Falk
Posts: 4
Registered: ‎06-16-2011
My Device: 9800
My Carrier: Vodafone Deutschland
Accepted Solution

Browserfield don't works after update my 9800

Hello.

After a software update from v.6.0.0.246 to v.6.0.0.546 my browser control shows the content only once.

After I poped the screen with die browserfield from the display stack and pushed it later to the stack, no content is shown.

And yes it happened also if u set the content in the onDisplay() event with requestContent().  Also fails refresh() or other funktions of the field to show/paint something. The browserfield stays empty!

In software version v.6.0.0.246 everything works fine. Whats wrong?

 

Here a little sample program with the problem:

public final class BrowserPopPushTest extends  UiApplication
{
  public static MyMainScreen myMainScreen = null;
  public static MyBrowserScreen myBrowserScreen = null;	

  public static void main(String[] args)
  {
    BrowserPopPushTest app = new BrowserPopPushTest();
    app.enterEventDispatcher();
  }	

  public BrowserPopPushTest()
  {	
    myMainScreen = new MyMainScreen();
    myBrowserScreen = new MyBrowserScreen();
    pushScreen(myMainScreen);
  }
}

 with 2 screens:

1.

public final class MyMainScreen extends MainScreen implements FieldChangeListener
{
  ButtonField mButton = null;
		
  MyMainScreen()
  {
    mButton = new ButtonField("Goto Browser screen", ButtonField.CONSUME_CLICK);
    mButton.setChangeListener(this);
    add(mButton);		
  }

  public void fieldChanged(Field field, int context)
  {
    if (field == mButton) 
    {   			
      UiApplication.getUiApplication().pushScreen(TestBEA1.BrowserPopPushTest.myBrowserScreen);
      UiApplication.getUiApplication().popScreen(TestBEA1.BrowserPopPushTest.myMainScreen);
    } 
  }

  protected boolean onSavePrompt()
  {
    return true; 
  }    
}

2.

public final class MyBrowserScreen extends MainScreen 
{
  private BrowserField myBrowserField;

  MyBrowserScreen()
  {
    myBrowserField = new BrowserField();
    add(myBrowserField);
  }

  public void onDisplay()
  {
    myBrowserField.requestContent("local:///LocalText.html");
  }	

  public boolean onClose() 
  {
    UiApplication.getUiApplication().pushScreen(TestBEA1.BrowserPopPushTest.myMainScreen);
    UiApplication.getUiApplication().popScreen(TestBEA1.BrowserPopPushTest.myBrowserScreen);
    return true;
  }    	
}

 Very simple.

If u press the button on the first sreen (myMainScreen) the second screen(myBrowserScreen) will pushed on the stack and shows the content from a local file in the browserfield.

If u go back (BB button on the device) first screen will pushed, second poped.

AND if u now press the Button on the first sreen once again the second screen is shown with the empty browserfield. There is no chance to load any content to the field.

AND the BB back button also do not work now!

 

Whats happened in this firmeware version?

Any ideas?

 

Please use plain text.
New Contributor
Falk
Posts: 4
Registered: ‎06-16-2011
My Device: 9800
My Carrier: Vodafone Deutschland

Re: Browserfield don't works after update my 9800

Nobody else got the Problem with the Browserfield?

No ideas?

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,555
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Browserfield don't works after update my 9800

Hello Falk,

 

This appears to related to known issues with BrowserField as of 50 whenever the UiEngine is detached from the containing screen:

- https://www.blackberry.com/jira/browse/JAVAAPI-1468; and

- https://www.blackberry.com/jira/browse/JAVAAPI-1465

 

Based on the noted discussions, I would expect that your approach of calling BrowserField.requestContent(...) on display would properly reload this content; however I am seeing the same issues you are and have reproduced using the latest 7.0 SDK.

 

One recommendation I would make is to drop onDisplay() and make use of onUiEngineAttached(...) instead, as onDisplay() has been deprecated.

 

The workaround I have found includes:

1) Doing nothing in the constructor for MyBrowserScreen.

2) If the UI engine is attached, we set myBrowserField to a new BrowserField, attach it to the screen, and request the content.

3) If the UI engine is detached, we delete all the fields on the screen and set our BrowserField Object (myBrowserField) to null.

 

* You could also omit myBrowserField completely.

 

The above implementation prevents the issues with:

1) Being unable to re-request content; and

2) The escape key not working.

 

I've also tried catching any Exceptions to see if something was erroring out mid-way, but the code appears to execute successfully (aside from the requestContent() method simply not having any effect.)

 

Would the above approach meet your needs?

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
New Contributor
Falk
Posts: 4
Registered: ‎06-16-2011
My Device: 9800
My Carrier: Vodafone Deutschland

Re: Browserfield don't works after update my 9800

Thanks Erik for the response.

I am able to redesign the application next week. I will figure out if your solution to prevent the problems with the browserfield can used in my app.

 

Till then

Falk

Please use plain text.
New Contributor
Falk
Posts: 4
Registered: ‎06-16-2011
My Device: 9800
My Carrier: Vodafone Deutschland

Re: Browserfield don't works after update my 9800

OK Erik,

 

I have implemented the way you suggest.

My application now works fine again.

 

Thank you

Falk

 

 

 

Please use plain text.
New Contributor
abuwarez
Posts: 3
Registered: ‎09-24-2012
My Device: latest bold 9???
My Carrier: orange

Re: Browserfield don't works after update my 9800

Hello,

 

I'm having the same issue here: http://supportforums.blackberry.com/t5/Java-Development/Threading-issue-and-Blank-Browserfield/m-p/1...

 

So, you're saying i need to create a new browserfield whenever i need to redisplay the contents of the SAME webpage? I don't think this is acceptable in terms of data traffic and load time.

 

In order to improve user experience, i;m trying to cache the webpage locally and display it inside a new BrowserField using BrowserField.displayContent(byte[] ...), avoiding unnecessary data traffic and reducing the loadtime. But there are issues with images which are fetched in separate http requests... which i need to parse from the initial webpage. Not to mention the JavaScript which may  have already modified the webpage in the previous browserfield.

 

Is there any other way to solve this inconvenience?

Please use plain text.