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