Sorry but you can't do that.
Main Thread is only used to manipulate UI and not for long operations...
The progress
will freeze also as it is part of the UI Thread. Have a look on Google Guidelines and if you really want to do that, have a look on ProgressDialog
.