I have one of my activities which I would like to prevent from rotating because I'm starting an AsyncTask, and screen rotation makes it restart.
Is there a way to tell this activity "DO NOT ROTATE the screen even if the user is shaking his phone like mad"?
<activity> element/s in
the manifest and you're done.
You can follow the logic below to prevent auto rotate screen while your
AsyncTask is running:
AsyncTaskrestore your previous orientation status using
Please note that there are several ways to access
Activity (which runs on UI thread) properties inside an
AsyncTask. You can implement your
AsyncTask as an inner class or you can use message
Handler that poke your