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