java.lang.NullPointerException:尝试调用虚方法' void android.widget.ImageView.setImageBitmap(android.graphics.Bitmap)' com.example.piker.MultipleShareActivity上的null对象引用$ ImageAdapter1.getView(MultipleShareActivity.java:153)
public View getView(int position, View convertView, ViewGroup parent) {
Log.e("122","after");
int width = getScreenWidth();
LinearLayout linearLayout;
linearLayout= (LinearLayout) findViewById(R.id.lins);
ImageView iv=new ImageView(con);
ImageView iv;
iv= (ImageView) findViewById(R.id.ims);
CheckBox cb=new CheckBox(con);
iv.setImageBitmap(mThumb[0]);// finding error in this line & mthumb is bitmap array//
linearLayout.addView(iv);
linearLayout.addView(cb);
return linearLayout;
}
答案 0 :(得分:0)
使用此
convertView.findViewById
在imageview和linearlayout中