BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 02-03-2010, 11:40 AM   #1 (permalink)
New Member
Join Date: Dec 2009
Model: 8830
Carrier: bell mobility
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up IllegalStateException error

Please Login to Remove!


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)
if(UiApplication.isEventDispatchThread() == true)
System.out.println("is Event Thread");
System.out.println("NOT Event Thread");
//phoneStatus = 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,

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.