空指针异常,且 connection = (HttpURLConnection) url.openConnection();此时connection的状态值为false??
空指针异常!!!自己敲写时,在imageloader中的onPostExecute方法中报空指针异常,此方法内部的imageView和bitmap均不为空, 谁能帮忙看下是什么原因呢?谢谢,而且我debug时发现imageloader中的getBitmapFromUrl方法HttpURLConnection connection = (HttpURLConnection) url.openConnection();此时connection的状态值为false,我运行正常的代码时为true,网络权限已经给了,找了一天没发现问题,求大神帮忙看下,不胜感激!!!
connection.setConnectTimeout(5 * 1000);
@Override
protected void onPostExecute(Bitmap bitmap) {
// TODO Auto-generated method stub
super.onPostExecute(bitmap);
// if (mImageView.getTag().equals(mUrl)) {
// mImageView.setImageBitmap(bitmap);
// }
ImageView imageView = (ImageView) mListView.findViewWithTag(mUrl);
if (imageView != null && bitmap != null) {
mImageView.setImageBitmap(bitmap);
}
mTask.remove(this);
}
}