Creating integer array of resource IDs Creating integer array of resource IDs arrays arrays

Creating integer array of resource IDs


Use just "array" instead of "integer-array". See Typed Array in the developer guide.


See XML integer array, resource references, getIntArray

TypedArray ar = context.getResources().obtainTypedArray(R.array.my_array);int len = ar.length();int[] resIds = new int[len];for (int i = 0; i < len; i++)    resIds[i] = ar.getResourceId(i, 0);ar.recycle();// Do stuff with resolved reference array, resIds[]...for (int i = 0; i < len; i++)    Log.v (TAG, "Res Id " + i + " is " + Integer.toHexString(resIds[i]));


Make a LevelListDrawable. Although it is not exactly what you want, but pretty much achievable.