views:

21

answers:

0

When I click, the following code leads the two sounds to be played not simultaneously, but sequentially. Why are they not played simultaneously?

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mytextview=(TextView) findViewById(R.id.textview);
    mytextview.setOnClickListener(this);

    sp=(SoundPool) new SoundPool(8,0x00000003,1);
    upSound=sp.load(this, R.raw.sound1, 1);
    downSound=sp.load(this, R.raw.sound2, 1);
}

    @Override
public void onClick(View v) {
    sp.play(downSound, VOLUME, VOLUME, 1, 0, 1);
    sp.play(upSound, VOLUME, VOLUME, 1, 0, 2);
}