This is may be old question but i dont get proper solution if it is wrong please ignore otherwise please halp me
I have one main screen with two verticleManagers
1)For browserField 2)one button
first i add successfully My Browserfield to First verticlemanger and also add button to second verticlemanager
finally two verticlemanager added to main screen.
in OS6 i dont get any problem it works fine
but in OS5 i got problem that is
once the Browserfield is getting focus, it never release its focus so i am unable to navigate downside of the Browserfield. Means i am unable to click on blackberry advertisement Banner.i am unable to navigate down from browserfield using trackpad
this is my sample code
class browserScreen extends MainScreen
{
String url;
BrowserField browserField;
public browserScreen() {
VerticalFieldManager main_mgr=new VerticalFieldManager(){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
VerticalFieldManager browserfield_mgr=new VerticalFieldManager(){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight()-50);
setExtent(Display.getWidth(),Display.getHeight()-50);
}
};
url="http://www.google.com";
BrowserFieldConfig browserFieldConfig = new BrowserFieldConfig();
browserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER);
browserFieldConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED,Boolean.TRUE);
browserFieldConfig.setProperty(BrowserFieldConfig.ALLOW_CS_XHR,Boolean.TRUE);
browserField=new BrowserField(browserFieldConfig);
browserField.requestContent(url);
browserfield_mgr.add(browserField);
main_mgr.add(browserfield_mgr);
VerticalFieldManager button_mgr=new VerticalFieldManager(){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),50);
setExtent(Display.getWidth(),50);
}
};
button_mgr.add(new SeparatorField());
ButtonField btn=new ButtonField("BUTTON MANAGER");
button_mgr.add(btn);
main_mgr.add(button_mgr);
add(main_mgr);
}
}
any help can be appreciated
After i googled a lot i conclude that This is OS 5 issue. it wont resolve it in OS5. It resolved In OS6. You have to provide a way to move the focus off the BrowserField yourself. I have tried a variety of mechanisms to do this, like detecting Escape in the Screen's keyChar method, the best I have found so far is to use the Menu and give the users the option of swapping focus out of the BrowserField. In general I do not recommend sharing the Screen between a Web Field and any other.
public class LoadingScreen extends MainScreen
{
VerticalFieldManager vertical;
HorizontalFieldManager hor;
String url;
BrowserField browserField;
Banner bannerAd ;
private static boolean flag=false;
public LoadingScreen()
{
//
VerticalFieldManager Veret=new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL|Manager.NO_HORIZONTAL_SCROLL){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
//Veret.setBackground(BackgroundFactory.createSolidBackground(Color.BLACK));
VerticalFieldManager main_mgr=new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL|Manager.NO_HORIZONTAL_SCROLL){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight()-50);
setExtent(Display.getWidth(),Display.getHeight()-50);
}
};
url="http://www.google.com";
BrowserFieldConfig browserFieldConfig = new BrowserFieldConfig();
browserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER);
browserFieldConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED,Boolean.TRUE);
browserFieldConfig.setProperty(BrowserFieldConfig.ALLOW_CS_XHR,Boolean.TRUE);
browserField=new BrowserField(browserFieldConfig);
browserField.requestContent(url);
main_mgr.add(browserField);
Veret.add(main_mgr);
final Bitmap ad_bg=Bitmap.getBitmapResource("add_bg.png");
VerticalFieldManager add_back=new VerticalFieldManager(USE_ALL_WIDTH|Field.FOCUSABLE){
protected void paint(Graphics graphics) {
graphics.drawBitmap(0, 0, ad_bg.getWidth(), ad_bg.getHeight(), ad_bg, 0, 0);
super.paint(graphics);
}
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(ad_bg.getWidth(), ad_bg.getHeight());
setExtent(ad_bg.getWidth(), ad_bg.getHeight());
}
};
try{
Bitmap customPlaceholder = Bitmap.getBitmapResource("add_bg.png");
bannerAd = new Banner(31848, null, 100000, customPlaceholder);
bannerAd.setBorderColor(Color.RED);
int i=(Display.getWidth()-320)/2;
bannerAd.setPadding(0, 0, 0, i);
bannerAd.setBannerTransitionColor(Color.RED);
bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);
// Dialog.inform(""+bannerAd.getMMASize());
}catch (Exception e) {
Dialog.inform(e.getMessage());
}
add_back.add(bannerAd);
Veret.add(add_back);
add(Veret);
}
protected void makeMenu(Menu menu, int instance)
{
int i=Integer.parseInt(StartUp.getOsVersion().substring(0, 1));
if(i<6)
menu.add(_testItem);
}
private MenuItem _testItem = new MenuItem("Go to Advertise", 100, 9)
{
public void run(){
bannerAd.setFocus();
}
};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With