问题
I am new to Blackberry development and Im trying to simple get a BrowserField working.
I get this errormessage:
Tried reinstalling JDE etc. etc. but the app always gets an error when I run it on the simulator.. Any ideas?
Here is my code:
package mypackage;
import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
/**
* This class extends the UiApplication class, providing a graphical user interface.
*/
public class HelloBlackBerry extends UiApplication {
private MainScreen _screen;
private BrowserField _bf2;
HelloBlackBerry()
{
_bf2 = new BrowserField();
_screen = new MainScreen();
_screen.add(_bf2);
pushScreen(_screen);
_bf2.requestContent("http://www.blackberry.com");
}
public static void main(String[] args)
{
HelloBlackBerry app = new HelloBlackBerry();
app.enterEventDispatcher();
}
}
I do not have a Blackberry device to test on yet.
回答1:
Normally, enabling the Mobile Data System Connection Service (aka MDS-CS) would have solved this BUT the MDS-CS version supplied with JRE 7.0.0 (9930 simulator) is incorrect! The original post on BlackBerry's forums can be found here.
According to this post:
An incorrect version of MDS-CS simulator was included in 7.0. To correct it you can delete it and copy the version from 6.0.
Deleting the invalid MDS version from JRE 7.0.0 and replacing it with the one from JRE 6.0.0 fixed the BrowserField issue for me. Don't forget to close and rerun the simulator and before reruning the application.
Here is a link to my original answer.
回答2:
I too am having the same Problem and i came to know that as its the Runtime Exception so i suggest you to please write it in try catch block it seems it will work..
Thanks.
回答3:
I want to suggest your one other thing that please rightclick on your project in eclipse and click on debug as... and in that click on debug configuration... and in that go into Simulator... and in that menu Select Launch Mobile Data System Connection Service with simulator... and there click on Apply and Debug it will work.
Thanks.
回答4:
I got the Browser screen from your code; The thing is:
Before open the application some times you have to open the Blackberry browser and check any link(For Ex: http://google.com) even though you connect the internet settings and then run your application.
public class StartUp extends UiApplication
{
public static void main(String[]ali)
{
StartUp start=new StartUp();
start.enterEventDispatcher();
}
public StartUp()
{
MainScreen screen = new MainScreen();
BrowserField browserField = new BrowserField();;
screen.add(browserField);
pushScreen(screen);
browserField.requestContent("http://www.google.com/news");
}
}
回答5:
This is a issue in blackberry please take a look into this
http://btsc.webapps.blackberry.com/btsc/microsites/search.do?cmd=displayKC&docType=kc&externalId=KB25846&sliceId=1&docTypeID=DT_SUPPORTISSUE_1_1&dialogID=1895604766&stateId=0%200%201895610037
来源:https://stackoverflow.com/questions/8588062/blackberry-browserfield-error-in-simulator