For example, I have the following class:
public class MyClass{
private static int x;
private AsyncWorker worker;
public void myVoid(){
worker = new Worker;
worker.execute();
if (x == null){
Log.v("Say something: ", "x is null");
}
}
class AsyncWorker extends AsyncTask<Void, Void, Void>{
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
x = 10;
return null;
}
@Override
protected void onPostExecute(Void result){
super.onPostExecute(result);
}
}
}
At the result, it prints that x is null. Is there any way to change x from AsyncTask and use it's value in future?
x == nullcheck will execute immediately aftertask.execute()