Pause in AsyncTask

Hi, for the assignment, I’m trying to add the pause functionality in my class (which extends AsyncTask). However, I don’t understand how this can be done. According to this thread on StackOverflow (https://stackoverflow.com/questions/2474584/pause-and-resume-asynctasks-android), pausing/resuming AsyncTask is not a good use. I’m also not able to understand the solutions mentioned. How should I proceed? Thanks!

For only the purpose of your understanding, pause functionality(Async Task) Assignment has been given. In projects, CountdownTimer is used.
However for the purpose of completing the assignment, you can follow this post.

In this, you have pause(),resume(),doinBackground() and sleep() inside your anync task. isPaused is a variable inside the async task whose initial value is false. Whenver pause button is pressed by user, then asynctask’s pause button is called. doInBackground() checks if asynctask is running or not and then checks isPaused value.