-2

I'm trying to fill this array with pictures(png) and I got an error.. any suggestions?

//body part images
private ImageView[] bodyParts;


bodyParts = new ImageView[numParts];
bodyParts[0].setImageResource(R.drawable.stage1);
bodyParts[1].setImageResource(R.drawable.stage2);
bodyParts[2].setImageResource(R.drawable.stage3);
bodyParts[3].setImageResource(R.drawable.stage4);
bodyParts[4].setImageResource(R.drawable.stage5);
AR1
  • 4,507
  • 4
  • 26
  • 42

1 Answers1

1

This error appeared because there is no imageview in the array, you used the method setImageResource() on a null object , the array bodyParts don't contains any imageview