有谁知道为什么 doInBackground 需要很长时间才能开始?这是一个例子:
runDoInBackground(){
print("starting task");
new MyAsyncTask(someObject,otherObject).execute((Void)null);
}
private class MyAsyncTask extends<Void,Void,Integer>{
SomeObject someObject;
OtherObject otherObject;
public MyAsyncTask(SomeObject someObject, OtherObject otherObject){
this.someObject=someObject;
this.otherObject = otherObject;
}
@Override
protected Integer doInBackground(Void... params) {
print("start background run")
... work ... get from server ...
}
}
如果运行缓慢的原因是其他干扰线程(我对此表示怀疑),我该如何给这个最高优先级?