开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜