I know this question has been discussed several times like here and here.
But my problem is still not solved because most solutions provided are either not suggested or deprecated.
I have an AsyncTask
in which I update a TextView
text continuously. The execution of the task is started in a toggle button click. Initially I had the AsyncTask
as an inner class to the main activity. But I later changed it to an external class.
I am using onSaveInstanceState()
and onRestoreInstanceState()
methods to store and restore the textview value during an orientation change. What I am not able to achieve is after the orientation, how do I restore the button state and also resume the AsyncTask
?