Anyway I have two sections that the array should take care of (unless there is a better way?), the first of which is for the sounds. It goes from sound1 to sound33:
Using java Syntax Highlighting
- mSoundManager = new SoundManager();
- mSoundManager.initSounds(getBaseContext());
- mSoundManager.addSound(1, R.raw.sound1);
- mSoundManager.addSound(2, R.raw.sound2);
- mSoundManager.addSound(3, R.raw.sound3);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
The second part is the buttons themselves (1 through 33):
Using java Syntax Highlighting
- Button SoundButton1 = (Button)findViewById(R.id.sound1);
- registerForContextMenu(SoundButton1);
- SoundButton1.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- mSoundManager.playSound(1);
- }
- });
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
For the Array I think I have the basic concept down, but obviously I am doing something wrong.
Using java Syntax Highlighting
- int[] btnList = new int[33];
- for (int i = 0; i < btnList.length; i++){
- mSoundManager.addSound(btnList[i], R.raw.sound[i]);
- Button SoundButton[i] = (Button)findViewById(R.id.sound[i]);
- registerForContextMenu(SoundButton[i]);
- SoundButton[i].setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- mSoundManager.playSound([i]);
- }
- });
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
I am not sure what I need to do to fix this though. It doesn't like me only using [i], so I see that I should instead be using btnList[i], but in the case of "SoundBoard1" or "sound1", how would I get it to return the number 1? Any help is greatly appreciated!

