Waiting for ASyncTask to finish or variable to be set
Just put your code which you want to execute after the Variable is changed in a function and call this function from onPostExecute.
If you are dependent on the result of an AsyncTask, you can do this.
Object result = asyncTask.execute().get();
The type of the result is the return type in your doInBackground() method. But then your main thread will be waiting until the task is complete.