I have a dialog fragment that shows while my application is doing a task.
I cancel the task that is being executed on the activities onDestroy()
method is called.
If the user rotates while the popup is showing, android destroys the activity and then redraws it. So I have told it to cancel the task in the onDestroy()
method. It then stops executing the task and the popup stays there. As it is normally only removed when the task has completed.
I know this is probably not the best way to go about doing it, but I feel it will be a quick fix to my issue and it wont cause any other issues (that I know of).
I want to disable rotation for my application just before the popup is shown, and then I want to re-enable it when the dialog is dimsised.
How would I do this programtically?
like so:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
?
And where would I do it? In the onCreate()
of the dialog? or before I call the dialog from the activity?