For a college project I need to develop an Android app that retrieves JSON data from an API and displays it in a RecyclerView. One of the app requirements is that the Asynctask shouldn't be re-executed after changing screen orientation. In other words, once the Asynctask is executed and the RecyclerView is displayed with the retrieved data, it shouldn't have to retrieve the data again after rotating the screen.
For demonstration purposes I've added a toast in the onPostExecute method that shows the amount of items that have been displayed:
As you can see, the toast reappears after rotating the screen, meaning the Asynctask was re-executed. I want to prevent this from happening, but I can't figure out how.