How can I switch back to main thread from a different thread when there is an exception. When an exception is raised on a child thread, I want a notification to be sent to main thread and execute a method from the main thread. How can I do this?
Thanks.
Additional information
I am calling a method from my main method and starting a new thread there after some calculations and changes
Thread thread = new Thread() { @Override public void run() { ..... } } thread.start();
When the exception occurs in the child thread, what is the main thread going to be doing? It will have to be waiting for any errors in a child thread.
You can establish an
UncaughtExceptionHandlerin the child thread, which can raise an event that the main thread is waiting for.