Reputation: 894
I have a problem whe I want to display web page. I use
BrowserField bwrField = new BrowserField(config);
add(bwrField);
bwrField.requestContent(URI.create(url.toSring());
I can run many page web with this code and the page is opened by the default browser in simulator but I have a problem with one page that diplay in little space in the screen. How Can I manipulate the width and the hight of the swreen browser Field. There is another method like the default browser to run this page
Upvotes: 0
Views: 238
Reputation: 965
Place your broswerfiled inside your manager and try overriding the managers sublayout method.
Somehing like this:
class MyFieldManager extends VerticalFieldManager
{
int width;
int height;
MyFieldManager(int w,int h)
{
super(Manager.VERTICAL_SCROLL | Manager.HORIZONTAL_SCROLL );
width=w;
height=h;
}
public void sublayout(int w,int h)
{
super.sublayout(w, h);
setExtent(width,height);
}
}
BrowserFieldConfig config = new BrowserFieldConfig();
config.setProperty(BrowserFieldConfig.ALLOW_CS_XHR, Boolean.TRUE);
config.setProperty(BrowserFieldConfig.INITIAL_SCALE, new Float(0.5));
MyFieldManager m=new MyFieldManager(Display.getWidth()/2,Display.getHeight()/2);
add(m);
BrowserField _browserField = new BrowserField(config);
_browserField.addListener(new InnerBrowserListener());
m.add(_browserField);
I hope this will help you.
This is not my code took from one of the forum, but it is a proven solution :)
Upvotes: 1