Hi plusminus, I have a problem with a Progress Dialog in a MapActivity. The dialog is displayed but
when I invoke dismiss() method the following error occur:

The source code of the ProgressDialog is:
Using java Syntax Highlighting
progressDialog = ProgressDialog.show(getActivityContext(),"Searching Path",
"Please wait while searching...", false,false);
threadDialog = new Thread(new Runnable() {
public void run() {
progressDialog.dismiss();
}
});
startFetchDirections(start_point,"",end_point,"");
Parsed in 0.032 seconds, using
GeSHi 1.0.8.4
Then, in startFetchDirections method, after that directions have been determinated the
threadDialog thread is launched with threadDialog.start(); as follow:
Using java Syntax Highlighting
private void startFetchDirections(MapPoint from_pos, String from_name,
MapPoint to_pos, String to_name) {
/* mDD is a class variable for the activity that will
* hold an instance of the DrivingDirection object created here. */
myDD = new DrivingDirection(from_pos, from_name, to_pos, to_name);
if (myDD != null) {
/* Add the request the dispatcher */
getDispatcher().addDataRequest(myDD);
t = new Thread(new Runnable() {
public void run() {
/*
* Wait for the search to be complete...
* or after 30 seconds search is interrupted
*/
int elapsedTime = 0;
while (!myDD.isComplete() && elapsedTime < 300) {
try {
synchronized (waitObject){
waitObject.wait(100);
elapsedTime++;
}
}
catch (InterruptedException e) {
Log.e("DEBUGTAG", "'!myDD.isComplete()' was interrupted.",e);
}
}
/* Check to see if any Placemarks were found..
* if 0 then there is no route! */
turns = myDD.getTurnPoints();
if (turns != null) {
/* Set a flag to let the program know
* the directions are done... */
foundDirections = true;
goToTurn(0);
}
else{/* no route.. */
foundDirections = false;
myDD = null;
/* Let the user know that no route was found... */
}
synchronized (waitObject){
threadDialog.start();
waitObject.notifyAll();
}
}
});
waitObject = new Object();
try {
synchronized (waitObject) {
t.start();
waitObject.wait();
}
}
catch (InterruptedException e) {e.printStackTrace();}
}
}
Parsed in 0.036 seconds, using
GeSHi 1.0.8.4
Can you hel me ?
Thanks in advance