有人知道为什么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 ...
}
}
如果缓慢运行的原因是其他干扰线程(我对此表示怀疑),我该如何将此线程优先级设置为最高?