Load URL into webview and hide address bar

淺唱寂寞╮ 提交于 2019-12-12 02:12:58

问题


As i am newbie in BlackBerry development, i don't know what should i implement for the below problem:

I want to load web page inside the webview (Navigation should be within application) and hide the URL address bar of the webview.)

I know the solution we do in Android as to make webViewClient and load the same inside the WebView inside the Android. But i don't know about the exact solution for the BlackBerry.

One more thing, i have gone through BrowserField demo but i am not able to load even this example:

Update:

I am able to load the URL and below error is gone by starting simulator with MDS service.


回答1:


BrowserField should be the right solution. Make sure that the simulator is correctly configured by accessing a web page in the blackberry browser.




回答2:


Like this you can get:

public class LoadingScreen extends MainScreen implements FieldChangeListener
{
private ButtonField click;
private BrowserField browserField;  
private BasicEditField address;
private VerticalFieldManager ver;
public LoadingScreen() 
{       
    createGUI();                
}
private void createGUI() 
{
    ver=new VerticalFieldManager();
    address=new BasicEditField("Enter Address: ", "", 150, FIELD_HCENTER);//Enter here like "**http://www.google.com**"
    ver.add(address);
    click=new ButtonField("click");
    click.setFont(StartUp.font);
    click.setChangeListener(this);
    ver.add(click);
    add(ver);

    browserField=new BrowserField();
    add(browserField);
}
public void fieldChanged(Field field, int context) 
{
    if(click==field)
    {               
        browserField.requestContent(address.getText());
        delete(ver);
    }
}

protected boolean onSavePrompt() 
{
    return true;
}
public boolean onMenu(int instance) 
{
    return true;
}
}



回答3:


Configure your default BrowserfieldConfig Class and load the browser into that class as shown below.

        BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
        myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
        BrowserField browserField = new BrowserField(myBrowserFieldConfig);
        add(browserField);
        browserField.requestContent("http://www.google.co.in");

It will load the google page in a webview.



来源:https://stackoverflow.com/questions/8353462/load-url-into-webview-and-hide-address-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!