Android, an array within an array?
How can I put some arrays into one larger holder array?
Here are my arrays:
int [] mySoundArray = {R.raw.piano_c1, R.raw.piano_d1};
int [] mySoundArrayTwo = {R.raw.piano_e1, R.raw.piano_f1};
I've tried this but it errors:
int [] totalSoundArray = {mySoundArray, mySoundA开发者_StackOverflow中文版rrayTwo};
Use this syntax:
int [][] totalSoundArray = {mySoundArray, mySoundArrayTwo};
Explanation: this is because what you are creating is an array of an array of ints.
int i // an int
int[] ii // an array of ints
int[][] iii // an array of an array of ints
精彩评论