问题
I am trying to connect my device to a http server using wifi. But I am having this exception:
java.io.IOException radio is off
What is usually the cause of this and what should I check for?
Thank in advance.
回答1:
I've never had this error so I can't be sure. However it sounds as if your wifi reciever is turned off, try the following code.
if (RadioInfo.getState() == RadioInfo.STATE_OFF) {
if (Dialog.ask(Dialog.D_YES_NO, "You currently have no network connection\nDo you want to turn connections on?", Dialog.YES) == Dialog.YES)
{
//Activate GPRS
Radio.activateWAFs(RadioInfo.WAF_3GPP);
//Sleep for 10secs to allow wireless to activate.
// TODO (DG) DO THIS IN NEW THREAD TO PREVENT BLOCKING UI THREAD
try {
Thread.sleep(10000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
} }
来源:https://stackoverflow.com/questions/5257063/blackberry-java-io-ioexception-radio-is-off