ContentProvider insert() always runs on UI thread? ContentProvider insert() always runs on UI thread? multithreading multithreading

ContentProvider insert() always runs on UI thread?


Instead of calling mContentResolver.insert(), use AsyncQueryHandler and its startInsert() method. AsyncQueryHandler is designed to facilitate asynchronous ContentResolver queries.


I think your original problem may have been that you are calling the run method on your new thread (which causes execution to continue on the current thread) instead of calling the start method. I think this is what Bright Great was trying to say in his/her answer. See Difference between running and starting a thread. It's a common mistake.


Man.Relax yourself.And anything would looks better.At first,Start a Thread is Func start not Func run,if you want to start the new Thread not only call the func run.

new Thread(Runnable runnable).start();

Then I bet use Handler sometimes would be better than AsyncTask.