Ui Threading issue?
Please Login to Remove!
Hi,
I have wrote some code to check whether the radio is active, if it is not then it activates the radio. I store this code in a static class and call it before trying to hit a web service to save the call timing out.
The problem that i am having is that the app hangs when i call the code and turn on the Radio, but it doesn't hang if i show a Dialog.Alert(); message. I'm wondering if this has something to do with execution on current Thread stopping and when i call Dialog.Alert it makes Ui thread active???
Code:
[code]
//This is in class extending MainScreen
if (Functions.checkConnection()) {
//Create thread to call web service
}
//This is in Functions Class
public final class Functions {
public static boolean checkConnection() {
if (RadioInfo.getState() == RadioInfo.STATE_OFF) {
Application.getApplication().invokeAndWait(new Runnable() {
public void run() {
Radio.activateWAFs(RadioInfo.WAF_3GPP);
}});
Dialog.alert("ON");//If this line is in works fine, if not then times out.
}
}
}
[code]
Thanks in advance
|