有谁知道为什么doInBackground需要很长时间才能开始?这里有一个例子: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 ...
}
}
如果在低速行驶的原因是其他干扰线程(我怀疑),我怎么给这个最高优先级?
你怎么知道它很慢? – Szymon
您在哪里看到“打印”语句?实际上,我正在使用system.out.println进行日志记录,以了解它需要多长时间。在第一个打印语句之后,它需要很长的时间来看到第二个print语句。 –
什么时间差? – petey