问题
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