android 空指针错误
今天运行代码的时候遇到了空指针错误,错误发生在:
findImageView(queue);
queue在前面有定义:
int[] queue = { R.drawable.p1, R.drawable.p2, R.drawable.p3, R.drawable.p4,
R.drawable.p5, R.drawable.p6, R.drawable.p7, R.drawable.p8,
R.drawable.p9, 1 };
还有一个空指针发生在:
Drawable pic1 = getResources().getDrawable(queue[0]);
iv_1 = (ImageView) this.findViewById(R.id.ImageView01);
iv_1.setImageDrawable(pic1);
上面的代码我单独的跑是没有问题的,可是在mainActivity中设置Intent,跳转到上面这个Activity后就发生了这样的错误,谁能解释一下?
今天运行代码的时候遇到了空指针错误,错误发生在:
findImageView(queue);
queue在前面有定义:
int[] queue = { R.drawable.p1, R.drawable.p2, R.drawable.p3, R.drawable.p4,
R.drawable.p5, R.drawable.p6, R.drawable.p7, R.drawable.p8,
R.drawable.p9, 1 };
还有一个空指针发生在:
Drawable pic1 = getResources().getDrawable(queue[0]);
iv_1 = (ImageView) this.findViewById(R.id.ImageView01);
iv_1.setImageDrawable(pic1);
上面的代码我单独的跑是没有问题的,可是在mainActivity中设置Intent,跳转到上面这个Activity后就发生了这样的错误,谁能解释一下?
android:layout_width="wrap_content"
android:layout_height="wrap_content"