看到有人说内部类,其实可以不建内部类,给MyAsyncTask.java添加一个构造方法就可以。
private ImageView mImageView;
private ProgressBar mProgressBar;
public MyAsyncTask(ImageView image, ProgressBar progressbar) {
mImageView = image;
mProgressBar = progressbar;
}
在主Activity里实例化的时候把参数放进去
new MyAsyncTask(mImageView, mProgressBar);
private ImageView mImageView;
private ProgressBar mProgressBar;
public MyAsyncTask(ImageView image, ProgressBar progressbar) {
mImageView = image;
mProgressBar = progressbar;
}
在主Activity里实例化的时候把参数放进去
new MyAsyncTask(mImageView, mProgressBar);
2016-03-25