02-03-2010, 10:40 AM
|
#1 (permalink)
|
| New Member
Join Date: Dec 2009 Model: 8830 PIN: N/A Carrier: bell mobility
Posts: 1
Post Thanks: 0 Thanked 0 Times in 0 Posts
| IllegalStateException error Please Login to Remove! Hi,
I have a simple application with an UI which displays fixes, phone status and phone call number.
I implemented PositionListener and PhoneListener in separated classes.
When i run on simulator I got the "IllegalStateException" error when I tried to display the phone status and calling number (I simulate an Incoming call). The phone events are intercepted correctly. I add the phone listener in MainScreen class.
Below is the code used to display calling phone number on MainScreen:
public void callConnected(int callId)
{
System.out.println("fct-callConnected");
if(UiApplication.isEventDispatchThread() == true)
{
System.out.println("is Event Thread");
}
else
{
System.out.println("NOT Event Thread");
}
//phoneStatus = CONNECTED;
this.setPhoneStatus(CONNECTED);
displayPhoneNumber(callId);
displayPhoneStatus(CONNECTED);
}
and displayPhoneNumber function is:
private void displayPhoneNumber(int callId)
{
final PhoneCall call = Phone.getCall(callId);
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
phoneScreen.updatePhoneNumberLabel(call.getDisplay PhoneNumber());
}
});
}
When I simulate an incomming call the function "callConnected" is called (Ok) but when I tried to update PhoneNumber Label in MainScreen I got the error "IllegalStateException".
If I remove the InvokeLater() , because I'm not in another thread I got the same result.
My question is:
Should I run LocationListener and PhoneListener in different threads???
Thank you,
George. |
| Offline
| |