This code is based on the YouTube video Android Studio Tutorial - 67 - Download Image Using AsyncTask by Prabeesh R K. There are a few changes in particular this line ...
Using Dog API (https://dog.ceo/dog-api/) we receive a JSON containing a link to a picture, then we get a picture using this link. We have 2 asynchronous operations need to be performed sequentially.
Instantiate the above reference in onCreate() method of activity. Ex:- mProgressDialog = new ProgressDialog(this); // here this is the object of your activity mProgressDialog.setMessage("Please wait") ...