"Learning note" "bug" array null pointer exception

Source: Internet
Author: User

1  PackageCom.example.googleplay.ui.holder;2 3 Importjava.util.ArrayList;4 5 ImportAndroid.view.View;6 ImportAndroid.widget.ImageView;7 8 ImportCOM.EXAMPLE.GOOGLEPLAY.R;9 ImportCom.example.googleplay.http.HttpHelper;Ten ImportCom.example.googleplay.utils.BitmapHelper; One Importcom.example.googleplay.utils.UIUtils; A Importcom.lidroid.xutils.BitmapUtils; -  -  Public classHomescreenholderextendsBaseholder<arraylist<string>> { the  private imageview[] mimages = null;  -     Privatebitmaputils mbitmaputils; -  + @Override -      PublicView Initview () { +View view =uiutils.inflate (r.layout.layout_detail_picinfo); A   mimages = new imageview[5];  Mimages[0] = (ImageView) View.findviewbyid (R.ID.IV_PIC1);  Mimages[1] = (ImageView) View.findviewbyid (R.ID.IV_PIC2);  mimages[2] = (ImageView) View.findviewbyid (R.ID.IV_PIC3);  Mimages[3] = (ImageView) View.findviewbyid (R.ID.IV_PIC4); MIMAGES[4] =   (ImageView) View.findviewbyid (R.ID.IV_PIC5);  in          -Mbitmaputils =bitmaphelper.getbitmaputils (); to         returnview; +     } -  the @Override *      Public voidRefreshview (arraylist<string>data) { $         Panax Notoginseng          for(inti = 0; I <mimages. length; i++) { -             if(i>=data.size ()) { the                 //extra picture layout needs to be hidden + mimages[i].setvisibility (view.gone); A}Else { the                 //the picture to display + mimages[i].setvisibility (view.visible); -Mbitmaputils.display (Mimages[i], Httphelper.url + "image?name=" +Data.get (i)); $             } $         } -     } -}

In Refreshview this method mimages the null pointer exception, in fact, is the 16th row reason, the array assignment can only be assigned once, the assignment is not valid, should be written

1      Private Imageview[] mimages;

"Learning note" "bug" array null pointer exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.