我想在后台任务执行之前操作异步任务中的特定视图,但不确定如何将所需的参数传递给方法。当我做这样的事情时,我只是得到一个空指针
class CalcFib extends AsyncTask<Integer, Void, Long> {
private View v;
private int index;
public CalcFib(int i){
this.index = i;
}
@Override
protected void onPreExecute() {
//do something with this.index
}
@Override
protected Long doInBackground(Integer... params) {
long t = 1234;
return t;
}
@Override
protected void onPostExecute(Long result) {
}
}