final
int
[] sounds;
final
SoundPool soundz =
new
SoundPool(
100
, AudioManager.STREAM_MUSIC,
100
);
sounds =
new
int
[
10
];
sounds[
0
] = soundz.load(
this
, R.raw.keysound,
1
);
sounds[
1
] = soundz.load(
this
, R.raw.item5sound,
1
);
sounds[
2
] = soundz.load(
this
, R.raw.item23sound,
1
);
class
userThread
extends
Thread{
public
void
run(){
switch
(soundnum){
case
0
: soundz.play(sounds[
0
],
0
.5f,
0
.5f,
0
,
0
,
1
);
break
;
case
1
: soundz.play(sounds[
1
],
0
.5f,
0
.5f,
0
,
0
,
1
);
break
;
case
2
: soundz.play(sounds[
2
],
0
.5f,
0
.5f,
0
,
0
,
1
);
break
;
}
}
}
if
(musiconoff.equals(
"1"
)){soundnum =
0
;
Thread th =
new
userThread();
th.start();
}