I do not think that you can start your activity directly from the doInBackground () method, since it works in a different thread than the UI thread. I think the action should start in the user interface thread. But you can probably run it on onProgressUpdate (), which runs in the user interface thread.
source share