空指針異常,且 connection = (HttpURLConnection) url.openConnection();此時connection的狀態值為false??
空指針異常?。?!自己敲寫時,在imageloader中的onPostExecute方法中報空指針異常,此方法內部的imageView和bitmap均不為空, 誰能幫忙看下是什么原因呢?謝謝,而且我debug時發現imageloader中的getBitmapFromUrl方法HttpURLConnection connection = (HttpURLConnection) url.openConnection();此時connection的狀態值為false,我運行正常的代碼時為true,網絡權限已經給了,找了一天沒發現問題,求大神幫忙看下,不勝感激?。。?br />?? ??? ??? ??? ?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);
?? ??? ?}
?? ?}