大师求救~一划动就报空指针异常,检查了很久了
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at hulk.al.com.newsimooc.ImageLoader.loadImages(ImageLoader.java:133)
at hulk.al.com.newsimooc.NewsAdapter.onScrollStateChanged(NewsAdapter.java:84)
public void loadImages(int start, int end) {
for (int i = start; i < end; i++) {
String url = NewsAdapter.URLS[i];
Bitmap bitmap = getBitmapFromCache(url);
if (bitmap == null) {
newsAsyncTask task = new newsAsyncTask(url);
task.execute(url);
mTask.add(task);
} else {
ImageView imageView = (ImageView)mImageView.findViewWithTag(url);
imageView.setImageBitmap(bitmap);
}
}
}
public void onScrollStateChanged(AbsListView view, int scrollState) {
// mImageLoader.loadImages(mStart, mEnd);
if (scrollState == SCROLL_STATE_IDLE) {
mImageLoader.loadImages(mStart, mEnd);
} else {
mImageLoader.cancelAllTasks();
}
这个两个方法报错
ImageView imageView = (ImageView)mImageView.findViewWithTag(url);