Must be a way looping through this code:
private void loadSprites() {
this.sprites[0] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom01);
this.sprites[1] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom02);
this.sprites[2] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom03);
this.sprites[3] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom04);
this.sprites[4] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom05);
this.sprites[5] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom06);
this.sprites[6] = BitmapFactory.decodeResource(getResources(), R.drawable.ic_boom07);
}
Thanks!
Please look at below code for that.
First make int array
or Set this Image to ImageView using below code
And you can convert this image directly to bitmap and store into bitmap array using below code.
If I am understand your question, you want something like,
You can do that in a simple for loop.. and start from the first id and increment it by 1 at each loop.. though I don't recommend you to do this..
You should place your images in the assets folder. From their you can access them via their file name. See http://developer.android.com/reference/android/content/res/AssetManager.html.