new Thread(new Runnable(){
}).run();
vs
new AsyncTask().execute();
I was under the impression they were the same thing, both start a new worker thread but is that not the case?
The reason I ask is because if I try to do any sort of network connection using new Thread()
I get a NetworkOnMainThreadException
but when I put that same code in an async task I do not get that.
also another example of this difference is using google maps api v2 where all plots/show/hides have to be done on the main thread
but if I use new Thread()
to hide/show markers the appear fine but if I try to show/hide in an async task I get an exception saying it needs to be done on the main thread.
does new Thread()
really not start a worker thread??
EDIT
not sure why this was closed since the links provided I have read and did not answer my question and mentions nothing about using run()
vs start()
which does answer my question