Confused:About JAVA Multi-threading Programming
Recently, I'am working on multi-threading programming,However I encounter the following trouble.
On one hand,I make the program to run a dead loop.On the other hand, I try to perform another operation(such as open a dialogue).Sometimes,this might cause programe collapsed,followed by lots of exceptions.I don't know how to solve this problem, so I need your help.
Any help would be appreciated.
We'll need to see your code first, threads aren't the easiest of things to run through in your head because they don't run things in any particular sequence. Its possible to run the same threaded program through two different times and have it work once and not the other time if you're not careful with the programming.
Firstly, if your application is throwing unhandeled exceptions, it means that you havenīt put every method that throws an exception, in a try-catch block.
Try doing this and then you can make a custom System.out.printl("") in each catch block so you can find out where you are going wrong.
I use this as the easiest way to find out where my application is "crashing".
I may be wrong on this but I always program this way and it works for me.
I think, therefore I am....... I think.
What exceptions are being thrown? Do these exceptions only get thrown sometimes, or does it happen everytime? The exceptions will give you a line reference in your code when they dump the stack trace to the console, so if you find the first reference to one of the classes you wrote you'll see (hopefully) what is causing your problem. It may be the case that the problem only manifests itself at this point however, and the actual root of it is somewhere else. If you post your code and the exceptions we'll see what we can do
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center